Hi, when I print a metafile into a PDF with litePDF, the result is a faulty PDF. Acrobat Reader says it's buggy. I assume the metafile is correct. At least it can be displayed in e.g. OpenOffice without any problems. The EMF is also attached as a text file. I have little idea about the internals of litePDF. Can you help to localize the error in litePDF? Thank you!
Thanks for a bug report. Do you use any SDK (which one, if so) or you build the latest sources on your own, please? I noticed something similar with the latest sources once, thinking it was my fault (due to some tests) and didn't pay much attention to it.
If I read it correctly there's no text output, only drawing primitives. Then I'd guess the problem is possibly in the header/info of the PDF file. I need to dive into it, but I cannot promise when it'll be. My free time is limited at the moment.
If you can, try to use older SDK, whether it'll work properly with it. It can help to pin-point which change broke the PDF generation.
Thanks for the answer. No, I'm using the omf dll from the SDK. I've gone through all the SDKs back to 2.0.0. Always the same error.
Nice, thank your for a quick and thorough testing of this. I thought it's a regression after some update (possibly a PoDoFo update, which is used for the low-level manipulation), but if all the SDK versions generate for adobe reader broken PDF, then it is not a regression.
By the way, trying to open your PDF in evince 41.2 doesn't claim any error. It may not mean much, it can be the evince is just more forgiving (or the Adobe Reader less permissive after some update).
If I load the PDF into PDFcreator and then save it, the error is gone in Adobe. The wrong code will probably be removed or the PDF normalized.
Last edit: ralf stocker 2022-06-10
Interesting. I do not have that application. Would you mind to share the re-saved PDF file, please? It can be compared and hopefully found out what causes the problem. My understanding is that it's either in the drawing stream, or in the PDF data itself. What's the most weird, it begun to show only recently, I didn't see it with the old versions, which is the reason why I wanted to re-test with the old versions first.
Please see my attachment. PDFcreator is free: https://www.pdfforge.org/
Thanks you for the test case. There seems to be a problem in the drawing stream, probably a pop of the graphics context, without corresponding (pair) push. I'll investigate this further.
Just by an accident, a user opened a thread about similar problem, this time using PoDoFo directly, but there it looks like a problem with the font. At least on the first look. You can see the thread on their mailing list.
Exactly my mistake! You have found it. Thanks. Then now we have to wait for Podofo 1.0...
Do you mean you made the "pop" call, somehow accessing PoDoFo through the litePDF directly or even using the RestoreDC() GDI function without a pair SaveDC()? The list of the EMF instructions shows exactl one SaveDC() call and exactly one RestoreDC() call, from which I guess the problem is on the litePDF side, not on the way you use it.
No, I just meant that the error from the poster is exactly the same as mine.
I fixed this in [r34]. The problem was handling of the MetaRgn, which is handled as saving the graphics context and restore it on restore, but the MetaRgn count was "inherited" incorrectly between saved graphics states, causing too many calls to Restore() and in turn an invalid PDF content stream.
Related
Commit: [r34]
Great! Would you please create a new SDK too (litePDF-2.0.5.0-SDK)? I have no working C tool chain at the moment to build the DLLs.
I'm waiting for [#41] resolution, after which I plan to make a new release.
Related
Tickets:
#41Hi, only a quick info, I just made a 2.0.5.0 release. Let me know if it won't work for you. Thanks and bye, zyx.
Hi, thanks for the new release. Unfortunately the clipping is now broken. Please compare test__with_2040.pdf and test__with_2050.pdf. The circle should be clipped into half. Which is not.
Hmm, that's bad. I cannot get to this before weekend, unless anything more urgent will postpone it a bit further. I'll let you know when I have anything.
By the way, my antivirus claims your litePDF_test.exe in the .zip file contains a virus and prevents me to open the file.
The change for [#37] doesn't work well here. I'll reopen that ticket instead. Please, follow it for any further updates.
Related
Tickets:
#37Ok, thanks. 5 out of 71 virus scanners on Virustotal report a virus. Would say that's a false positive.
True, I guess so too.
Please see https://sourceforge.net/p/litepdf/tickets/37/#2431 for a test litePDF.dll