XOD looses resolution

330 views
Skip to first unread message

Perry Manole

unread,
Mar 12, 2014, 4:52:39 AM3/12/14
to pdfnet-w...@googlegroups.com
We have some large PDF blueprints with high resolution details. When I look at the original PDF the details are easily read but after the XOD conversion they become blurry and unreadable. I suspect there is some down sampling going on during the XOD conversion. Can this be controlled to maintain the original resolution?

Matt Parizeau

unread,
Mar 12, 2014, 3:26:44 PM3/12/14
to pdfnet-w...@googlegroups.com
You're correct you can control various options in the conversion process.  Take a look at this post for more information.  The ones most relevant to your case will be SetDPI and SetMaximumImagePixels.  You can pass the options as an extra parameter in toXod.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Perry Manole

unread,
Mar 13, 2014, 4:48:29 PM3/13/14
to pdfnet-w...@googlegroups.com
Is there a setting to just keep everything as was in the PDF originally without having to tweak with all the knobs and dials available in the options?

Matt Parizeau

unread,
Mar 13, 2014, 5:13:24 PM3/13/14
to pdfnet-w...@googlegroups.com
Probably the best way to do that would be to set max image pixels to a very large value, set the DPI fairly high and set the flatten option to off.  The only potentially dangerous one is DPI, but a value of 600 would probably work.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Perry Manole

unread,
Apr 1, 2014, 5:44:07 PM4/1/14
to pdfnet-w...@googlegroups.com
If I set the DPI to 600 and the original document is at 300 will it unecesarily increased to 600? I just want it kept at the original DPI no matter what it was. So is the DPI setting a ceiling cap or an absolute setting?

Matt Parizeau

unread,
Apr 2, 2014, 5:25:06 PM4/2/14
to pdfnet-w...@googlegroups.com
The DPI is an absolute setting so it will set every image to that DPI.  With that said we've done a bit more testing with your file and there are some other things you can try to preserve the quality.

One would be to set "flatten" off and "element limit" to a large value (e.g. 1 million).  This should stop the text from being flattened to an image and most of the diagram as well.  Because of some of the special blend modes in the PDF it seems that parts of the diagram are still flattened to an image which affects the quality.  This is where you could experiment with DPI settings to see if there is an acceptable level where the diagram looks ok.

Another option is to set the "render pages" option to false.  This will basically end up ignoring the special blend modes and the diagrams shouldn't be flattened to an image.  Depending on what the blend modes did this may affect the colors but possibly not enough to be a big deal.  I tried converting with this option and the diagrams I checked were able to maintain high quality when zooming in.  You'll have to check to make sure the output hasn't changed too much but this could be an acceptable solution.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Support

unread,
Apr 2, 2014, 6:55:06 PM4/2/14
to pdfnet-w...@googlegroups.com

Default XOD conversion is ‘flattening’ content. This means that some parts of PDF page that are very complex and would take really long to render are rasterized to an image. This way WebViewer can provide some guarantees regarding how quickly a page can be rendered on different systems (including mobile devices).

 

Your PDFs are extremely complex CAD drawings with tens of thousands of graphical elements. Unfortunately there is no-way of rendering these files interactively at full vector quality in a mobile browser. Now maybe this is not a problem for you (e.g. you are on desktop or you don’t mind waiting a bit to see full res output). In this case you may need to study and experiment with different conversion options.  For example,  you can turn off ‘flattening’, increase the resolution of the initial thumbnail image (so that it could be used as a high-rez placeholder), use PNG rather than JPEG, disable any type of rendering etc.

 

The following XOD is output from:

 

docpub32.exe -f xod "2090 Architecture Permit Set.pdf" --flatten off --thumbsize 1024 --prefer_jpg false -o flatt_off

 

http://www.pdftron.com/xod/flat_off.xod

in WebViewer: http://www.pdftron.com/webviewer/demo/viewer.html?d=../../xod/flat_off.xod&did=2

 

You could also disable any rendering by XOD conversion:

 

docpub32.exe -f xod "2090 Architecture Permit Set.pdf" --flatten off --norender --thumbsize 1024 --prefer_jpg false -o norend

 

http://www.pdftron.com/xod/norend.xod

in WebViewer: http://www.pdftron.com/webviewer/demo/viewer.html?d=../../xod/norend.xod&did=2

 

Perry Manole

unread,
Apr 2, 2014, 11:38:02 PM4/2/14
to pdfnet-w...@googlegroups.com
I keep getting this error in my browser when I open the converted XOD links you provided above as I zoom into the page:

Line: 1
Character: 7660
Code: 0
Error Message: Not enough storage is available to complete this operation.

Same happens when the file is hosted on my server too, with this converted file and others. I have plenty of memory on my system 6Gig with 2Gig free on 64bit Win7.

Matt Parizeau

unread,
Apr 3, 2014, 12:50:16 PM4/3/14
to pdfnet-w...@googlegroups.com
I'm going to guess that you're using IE9 or 10 when you see this error? In the past I had seen this in IE9/10 if the zoom level was large so that there were large images and canvases being created in WebViewer.  It seems like IE artificially limits the amount of memory that it can use (see here for example).  I haven't seen this error yet with IE11 and have never seen it in Chrome or Firefox.  Which browsers are you seeing that error in?

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Perry Manole

unread,
Apr 10, 2014, 5:43:15 PM4/10/14
to pdfnet-w...@googlegroups.com
I am using IE11.

Perry Manole

unread,
Apr 12, 2014, 2:33:16 AM4/12/14
to pdfnet-w...@googlegroups.com
Is there a way maybe to detect the size of the magnified document and only allow it to be zoomed up to a certain size? Basically stop the user from zooming too far otherwise when that error occurs the whole viewer crashes and stops responding to any commands. Its not any better in Chrome. No error but still stops responding to commands.

Perry Manole

unread,
Apr 12, 2014, 2:56:45 AM4/12/14
to pdfnet-w...@googlegroups.com
How do you do these setting through code (not command line):

I currently have something like this but not sure if I have exactly what you have in your example:

Dim objOptions As New pdftron.PDF.Convert.XODOutputOptions()
objOptions.SetThickenLines(False)
objOptions.SetFlattenContent(pdftron.PDF.Convert.FlattenFlag.e_off)
objOptions.SetThumbnailSize(1024)
objOptions.SetRenderPages(False)
objOptions.SetPreferJPG(False)

Not sure what the -o argument is in code. What's the difference between "--flatten off" and "-o flatt_off" or between "--norender" and "-o norend". Did I capture all these arguments in my code?

What do I do if I don't want thumbnails at all. Is there a way to turn them off to increase performance?
 


The following XOD is output from:

docpub32.exe -f xod "2090 Architecture Permit Set.pdf" --flatten off --thumbsize 1024 --prefer_jpg false -o flatt_off

 

You could also disable any rendering by XOD conversion:

Matt Parizeau

unread,
Apr 14, 2014, 7:28:35 PM4/14/14
to pdfnet-w...@googlegroups.com
To change the maximum zoom level you'll have to make some small modifications to ReaderControl.js. Search for the function setZoomLevelWithBounds and change where it has 5.0 to something smaller. 5.0 is equivalent to 500% and 2.0 would be 200%.
Next search for the initUI function and find $("#slider").slider and change max: 500 to max: 200.

Those options look correct. -o is used by DocPub for setting the output directory so you don't have to worry about that. To turn off thumbnails you can use SetOutputThumbnails(False).

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Matt Parizeau

unread,
Jun 11, 2015, 1:44:11 PM6/11/15
to pdfnet-w...@googlegroups.com
In WebViewer 2.0 you can just set ReaderControl.prototype.MAX_ZOOM in a config file. For example:
ReaderControl.prototype.MAX_ZOOM = 10;
Reply all
Reply to author
Forward
0 new messages