That is strange that you see a difference between PDFNetDotNet4 and PDFNetC. They are just thin wrappers around the exact same code. My hunch is that you are running different versions of PDFNet.
Regardless, the following settings influence how images are generated for XOD.
First, its important to clarify the two cases that the following apply.
- Image data in a PDF.
- Vector/text content that needs to be converted to an image, since XOD does not support all the graphics types possible with PDF format.
SetDPI : Sets the desired DPI of generated images. Higher value means higher quality, but larger file size. Also, browsers have bad (fast) down sampling algorithms, so there is often not much benefit in going to a DPI higher than 300, at least at low WebViewer zoom levels.
SetMaximumImagePixels : Some devices/platforms have max image values (e.g. 2MP on older iOS devices). PDFNet will break up images into slices. The exact size of the slices depends on the width, the DPI setting, and this setting. The downside of striping is that JPG/PNG compression is not as effective, so XOD file size can increase. That is, a single image will compress much smaller, then an image sliced up, even if both are at the same DPI. In otherwords, you want this setting as high as possible, with breaking any target platforms that your app targets.
SetPreferJPG : By default images are JPG, which gives great compression, but can result in compression artifacts if the images contain straight lines (like text). Setting this to false, will trigger PNG generation, and most likely a small increase in file size. However, browsers are much more optimized at JPG decompression, so PNG will be slower.
JPEG : faster render, but possible compression artifacts
PNG : slower render, always look good
SetJPGQuality : Assuming above setting is true (default) you can get smaller XOD files by turning this down. If the above setting is false, then this does nothing.
Is there a way to control the size of these tiles?
Yes, SetDPI and SetMaximumImagePixels combine to dictate the output of tiles. You could set SetMaximumImagePixels to the maximum value allowed (so no maximum) and that would essentially disable slicing.
Then XOD file is viewed these tiles caused redundant lines on the image…
Sounds like you are describing another issue.
If the above does not help, then first, I would recommend updating to the latest version of PDFNet.
If that does not help, please submit, either here publicly, or from our support page privately, the following information.
- Source PDF
- Generated XOD
- Screenshot of what you see in browser, clearly indicating browser and OS
- Clearly show (in screenshot) what you expected to see.
- Code+settings used to create the XOD