alafr / SVG-to-PDFKit

Insert SVG into a PDF document created with PDFKit
MIT License
403 stars 115 forks source link

Adobe products complain about patterns #49

Closed ebremmer closed 6 years ago

ebremmer commented 7 years ago

When I use patterns in my PDF's, Adobe Reader thinks file is broken or Adobe Illustrator says:

Acrobat PDF File Format is having difficulties. Error while parsing a Form, Type 3 Font, or Pattern.

Since I have no forms nor fonts in there I think it must be pattern.

auromota commented 7 years ago

Same problem here. Adobe Acrobat Reader gives a warning and stops rendering the file when I use patterns in the SVG. If I remove the patterns, it works flawlessly.

alafr commented 7 years ago

Thanks for the report. There was some kind of infinite loop of patterns in the pdf file structure. Sorry for the long delay. Please reopen the issue if the problem persists.

auromota commented 6 years ago

@alafr I've tested it in Adobe Acrobat XI 11.0.09 and the problem is gone. However, when I open the same PDF in Adobe Acrobat Reader DC 2018.008.20044, it still fails, as the reader seems to still get into some infinite loop.

EDIT: After fiddling with it a little, I found out it works (for both readers) as long as I have more than 1 page. It only fails if I have a single page PDF. I will investigate more and post here if I find something useful.

alafr commented 6 years ago

The problem comes probably from this line: https://github.com/alafr/SVG-to-PDFKit/blob/master/source.js#L17 Edit: I removed these arbitrary numbers. Is the bug still there?

auromota commented 6 years ago

@alafr Thanks for your answer and sorry for taking so long to reply. It was the problem indeed. The new version is working perfectly here. Thanks for sharing it with us! 👍