utelle / wxpdfdoc

wxPdfDocument - Generation of PDF documents from wxWidgets applications
http://utelle.github.io/wxpdfdoc/
Other
71 stars 27 forks source link

PDFImage fails to compile - Version 1.0.0 #78

Closed todinaca closed 3 years ago

todinaca commented 3 years ago

I'm using Visual Studio 205, and the wxpdfdoc_vc14 solution. We do not use UNICODE, thus we set the define wxUSE_UNICODE=0;

However, PDFImage fails to compile if this the above preprocessor is defined. It looks like there is a missing #IFDEF around this code.

pdfimage.cpp(1146): error C2664: 'wxScopedCharTypeBuffer::wxScopedCharTypeBuffer(const wxScopedCharTypeBuffer &)': cannot convert argument 1 from 'const char *' to 'const wxScopedCharTypeBuffer &'

pdfimage.cpp(1146): note: Reason: cannot convert from 'const char *' to 'const wxScopedCharTypeBuffer'

pdfimage.cpp(1146): note: No constructor could take the source type, or constructor overload resolution was ambiguous

utelle commented 3 years ago

I'm using Visual Studio 205, and the wxpdfdoc_vc14 solution. We do not use UNICODE, thus we set the define wxUSE_UNICODE=0;

Well, wxPdfDocument is of rather limited use in non-Unicode (= ANSI) mode, because font support is restricted to PDF built-in fonts and non-Unicode TrueType fonts.

I have to admit that I haven't tested wxPdfDocument in ANSI mode for ages. So, even if the library compiles without error, there is no guarantee that all features will work as expected.

In the wxWidgets documentation you find the following information:

Since wxWidgets 3.0 Unicode support is always enabled and while building the library without it is still possible, it is not recommended any longer and will cease to be supported in the near future.

Therefore I would strongly recommend to switch to Unicode mode.

However, PDFImage fails to compile if this the above preprocessor is defined. It looks like there is a missing #IFDEF around this code.

pdfimage.cpp(1146): error C2664: 'wxScopedCharTypeBuffer::wxScopedCharTypeBuffer(const wxScopedCharTypeBuffer &)': cannot convert argument 1 from 'const char ' to 'const wxScopedCharTypeBuffer &' pdfimage.cpp(1146): note: Reason: cannot convert from 'const char ' to 'const wxScopedCharTypeBuffer' pdfimage.cpp(1146): note: No constructor could take the source type, or constructor overload resolution was ambiguous

I will look into this. I will try to provide an alternative implementation for ANSI mode.

utelle commented 3 years ago

Commit c9cc0d781e42457fb22791249154d146c4abfdfa should fix the issue.