No, they are not - in fact, JPEG-compression in TIFF is a very bad idea (for
many reasons).
Leonard
From: Benjamin Podszun [mailto:[email protected]]
Sent: Friday, December 07, 2012 3:03 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Got an Image to insert into my PDF, need native
(System.Drawing.Image / java.awt.Image) back
One last question regarding compression support:
I understand that jpeg files will stay compressed, same for ccitt compressed
tif pages.
Are jpeg compressed tif pages supported? Will they stay reasonably
small/compressed as-is if I enumerate them using
TiffImage.GetTiffImage
to handle that input? I .. failed to find the code that actually handles the
compression before my first post here and I'm still lost where I'd see what
kind of images would be considered 'final' for inclusion.
Thanks,
Ben
On Fri, Dec 7, 2012 at 8:58 PM, Benjamin Podszun
<[email protected]<mailto:[email protected]>> wrote:
Okay, I don't care about existing files.
For new ones I accept the gentle nudges to stop thinking about ugly bandaid and
do it before itext even touches the file(s).
Noted.
Thanks again.
On Fri, Dec 7, 2012 at 8:38 PM, Leonard Rosenthol
<[email protected]<mailto:[email protected]>> wrote:
If you are doing this simply during future creation - then the problem is easy.
Check the input data and recompress as necessary.
The hard problem here is fixing/changing existing PDFs. Finding images is well
defined - you can find them. However, you don't know what they are :(. They
don't have identifiable names (eg. no foo.tiff reference). So unless you can
match them via some other unique criteria (such as position, size or
dimensions), you are blocked from any actual replacement.
Leonard
From: Benjamin Podszun
[mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, December 07, 2012 2:29 PM
To:
[email protected]<mailto:[email protected]>
Subject: Re: [iText-questions] Got an Image to insert into my PDF, need native
(System.Drawing.Image / java.awt.Image) back
Love your (often specification backed) support on anything PDF on this list.
That said:
Too big to be reasonable for my usecase. If the file could very well be 80
percent smaller without losing relevant information, I want to make that happen.
I'd like to fix that on my side, since this is a shared library in a couple
small tools. Sometimes the input is 'fine' (as in, small or in a format that's
coming out in an acceptable way), every now and then it's not, like in the case
here.
The easiest (in this case: least intrusive) change to my codebase would be a
small if-not-compressed-but-in-color workaround as above. I agree that I could
tackle the issue on multiple levels and some might be better, cleaner. But
everything I came up with involved more work than this idea, hence the question
if I can make use of the Image instance at hand in my snippet.
If the answer is a definite no I'll have to live with the file sizes. Or get
back to the drawing board for a couple of things.
On Dec 7, 2012 8:17 PM, "Leonard Rosenthol"
<[email protected]<mailto:[email protected]>> wrote:
Too big for what? But yes, if you want compressed images you need do that
ahead of time when using itext. OR you can use a variety of software solution
to optimize the PDF after creation. (or now!) Why not just use one of them
instead of wasting your time and effort to build something???
Leonard
From: Benjamin Podszun
[mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, December 07, 2012 12:55 PM
To:
[email protected]<mailto:[email protected]>
Subject: [iText-questions] Got an Image to insert into my PDF, need native
(System.Drawing.Image / java.awt.Image) back
Hi.
The core problem: Sometimes my PDFs are much too big. Like 20 MB for 5 pages.
It seems the culprit here are images that I add to/as pages, and in broken
cases like the one above the images seem to be uncompressed in the source and
won't be compressed by itext.
Searching the net turned me towards advice to make sure that the input file is
already (in my case) jped compressed. My solution for the size issue therefor
seems to be to create a (suitably) compressed jpeg first and feed that to itext
later.
Unfortunately the code is built around the idea of getting a
RandomAccessFileOrArray and more or less turning just that thing (a tiff with
multiple pages) into a PDF.
Pages might be compressed differently, I see no 'file global' way to handle the
conversion. I tried plugging some code into the "get me the page in the Tiff"
code:
Previously:
Image pageImage = TiffImage.GetTiffImage(imageData, pageIndex);
What I try now:
Image pageImage = TiffImage.GetTiffImage(imageData, pageIndex);
// Compress the image if it's including color and not yet a jpeg
if (pageImage.Bpc == 8 && !pageImage.IsJpeg())
{
// Need a way to get that pageImage in a format I can work with here
I could add a couple workarounds to still be able to grab the original backend
for the RandomAccessFileOrArray (imageData). But - that feels wrong.
pageImage allows me to access the RawData, but I've no idea what it contains
and my tries to feed that to a System.Drawing.Bitmap failed so far.
Is there a way to do the inverse of
Image.GetInstance(platformNativeImageInstance)?
My platform is .Net, but I'm reasonably good at java - so itext or itextsharp
shouldn't matter, I hope.
Thanks a lot for your time,
Ben
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
iText-questions mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
iText-questions mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php