Problem with exporting SVG to PDF

Post questions on how to use or achieve an effect in Inkscape.
Alan47
Posts: 3
Joined: Sun Sep 16, 2012 2:58 am

Problem with exporting SVG to PDF

Postby Alan47 » Sun Sep 16, 2012 3:05 am

Hello everyone,

I've got a standard inkscape *.svg file, containing some text, vector objects, some filters, and a couple of bitmaps.
When I export the file to PDF (just via File -> Save as...), the PDF is created *almost* correctly. What appears to be constantly missing are bitmap graphics which have their opacity in Inkscape set to anything else than 100% - the PDF exporter just seems to skip them when processing the export. I'm currently using Inkscape 0.48.2 r9819.

Does anybody else encounter this problem and is there a fix for it? I know that I can just edit the bitmap graphic to have transparency on its own and reimport it into Inkscape with opacity set to 100% for the same effect, but that's pretty annoying...


Thanks,



Alan

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Problem with exporting SVG to PDF

Postby brynn » Sun Sep 16, 2012 3:04 pm

Image
Welcome Alan!

Hhhm....ok, I've done a quick test and can't reproduce your problem (Win7, 64-bit, Inkscape0.48.1). I actually tested with a JPG, and not a BMP, but I think you meant raster when you said bitmap. Right?

At first I was thinking if you link the rasters, rather than embed, and you open the new PDF on a different computer (or move or remove the raster images from where they were linked) that they wouldn't show up in the PDF. But that appears not to be true. I moved the JPG to another folder, but it still shows in the PDF.

Are your raster images inside the page border? I'll test that.... Ok, the rasters would have to be entirely outside the border, not to show up at all. If they're partly outside the border, the part that's inside still shows up. But that's only if you used "Export area is page" option. If you used "Export area is drawing" the page border wouldn't matter.

Are any filters applied to the raster imports?

Alan47
Posts: 3
Joined: Sun Sep 16, 2012 2:58 am

Re: Problem with exporting SVG to PDF

Postby Alan47 » Sun Sep 16, 2012 9:09 pm

brynn wrote:Welcome Alan!


Thanks :D

brynn wrote:Hhhm....ok, I've done a quick test and can't reproduce your problem (Win7, 64-bit, Inkscape0.48.1). I actually tested with a JPG, and not a BMP, but I think you meant raster when you said bitmap. Right?


Well, I was talking about a raster graphics object, of course, but I should have added that it was actually a ".png" object which had some transparency already built into it. I embedded (not linked) the object into the *.svg file, and then turned down the opacity in Inkscape to about 60%, which worked nicely in the *.svg file, but when it is exported to PDF, it just does not appear at all. My system specs are almost the same as yours, except that I use version 0.48.2 of Inkscape. Could you try to reproduce the bug with a *.png file which has an alpha channel attached and a couple of transparent and semi-transparent areas in it? Would be interesting to know whether it works with 0.48.1, in that case I would just have to "down-grade" my Inkscape.

Oh, and by the way, the .png image was located entirely within the borders of my page, so that should not cause a problem at all. No filters attached to the imported raster, except for the opacity turned down a little.

Thanks for your efforts to help me with my problem!


Greets,


Alan

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Problem with exporting SVG to PDF

Postby brynn » Sun Sep 16, 2012 11:10 pm

Well, assuming I understand "with alpha channel attached", I still can't reproduce the problem. It seems to me that anything with transparency has an alpha channel. But if it means something else, if you can explain, I'll be glad to try again.

Here's what I did. I created some quick shapes with Inkscape, colored some opaque, and some with different levels of transparency. Then I exported a PNG with a fully transparent background. 4 different levels of transparency in the PNG. Then I imported to Inkscape, and added more transparency to the whole group of objects. Then Save As PDF. It opens with Adobe Reader, and displays exactly as expected.

I guess I didn't ask before, but that's what you're viewing the PDF with, right? If the transparency in the PNGs is the only transparency in the image, and you using something besides Adobe to view it, perhaps the viewer itself can't support transparency?

I wouldn't get rid of your copy of Inkscape just yet, though. You can run 2 different versions of Inkscape, if you want to get 0.48.1 and try it. But I'm suspicious of the filters. They can be problematic with file conversions. Inkscape seems to do ok with converting them to PDF, but it hasn't always been so. Although apparently the filtered content is displayed as you expect....so I guess it doesn't make sense that they could be the source of the trouble.

Text can sometimes be problematic, in file conversions in general. But again, PDF is fairly reliable, and also apparently text displays as you expect. Well, I'm baffled :|

If you can provide your SVG file, then those here who are qualified can look for the problem. I may or may not be able to spot the problem. But others here are more knowledgeable from the technical side. It's possible that a bug is responsible for the problem. But if it is, it's not one that I've heard of...or at least that rings a bell, as they say.

Alan47
Posts: 3
Joined: Sun Sep 16, 2012 2:58 am

Re: Problem with exporting SVG to PDF

Postby Alan47 » Mon Sep 17, 2012 8:42 pm

Hi again,

I was just preparing a couple of test files to demonstrate the issue when... it suddenly worked. I don't know why, I don't know how, but when I now export to PDF again, the PDF also contains the previously missing parts. I did not change a single thing in the source SVG file, though.

We're talking about rather big (greater than 20MB) SVG files, consisting of a single page with a lot of high-resolution photographical raster images. Inkscape had some trouble handling those, the application crashed several times during editing those SVG files, most likely due to memory issues (as far as I know, a 32bit-Application can only use up to about 3GB of RAM, even if there is more installed in hardware, 8GB in my case). Given that there must have been a lot of "undo" steps stored in memory, plus the fact that I had mutliple large files open in inkscape at the same time, this does not seem that unlikely.


I will make it a habit to close and restart the entire application before exporting to PDF in the future, because that's the only thing that is different right now compared to last time when the error with the exported PDF happened.


Thank you for your help!



Alan

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Problem with exporting SVG to PDF

Postby brynn » Tue Sep 18, 2012 2:19 am

Aaahh yes, large file sizes, when they challenge the user's machine's memory, are often problematic. I probably would not have been able to open them. But something else you can try is File menu > Vacuum Defs. It removes unused data in the file, and in some cases, helps performance.

I'm glad you got it working :D

amake
Posts: 3
Joined: Wed Apr 02, 2008 12:32 pm

Re: Problem with exporting SVG to PDF

Postby amake » Wed Nov 21, 2012 3:48 pm

I had a similar problem today: I imported a PDF, made some edits, and then exported the results, only to find that one of the bitmaps was missing from the PDF output.

I discovered that the bitmap had a mask and clip path applied from the original PDF. I'm still not sure if it was the values of the mask and clip path that were the problem, or if it's some combination of unsupported features or Acrobat Reader being finicky, but I simply removed the mask attribute (it didn't seem to do much visually) from the svg:image node, vacuumed unused definitions, and the problem disappeared.

If you're having trouble with a bitmap imported from a PDF or some other rich format, you might want to take a look at the underlying XML and see if there are any unwanted attributes or entities tagging along.


Return to “Help with using Inkscape”