Quantcast

replace HQ images

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

replace HQ images

Jason Berk-2
I have a DB with 2,533,228 PDF stored as blobs.  Most of those PDFs have
some HQ images, designed to be printed on a 300 or 600 dpi printer.  I
would like to download and optimize those PDFs with low quality versions
of the same image and then reload them.

Something like:

List<Long> accountList = select account from statements;
For(Long id : accountList){
        Byte[] pdf = select statement from statements where account = id
        pdf = optimizePdf(pdf);
        update statements set statement = pdf where account = id
}

The obvious trick is the optimizePdf method.  I know with Adobe Pro
there is an optimize option that took a 700KB statement down to like
36KB.  When I opened the optimized statement, it was obvious the
marketing images where very grainy and that's where most of the
optimization came from.  Can you get the images from each page of a pdf
and, if the image is for size X or larger, resize the image and reinsert
it?  There could be more than one image on a page, but marketing content
is by far the "largest" in terms of byte size or viewable size.

Any suggestions?

Jason Berk


This is a transmission from Purdue Federal Credit Union (Purdue Federal) and is intended solely for its authorized recipient(s), and may contain information that is confidential and or legally privileged. If you are not an addressee, or the employee or agent responsible for delivering it to an addressee, you are hereby notified that any use, dissemination, distribution, publication or copying of the information contained in this email is strictly prohibited. If you have received this transmission in error, please notify us by telephoning (765)497-3328 or returning the email. You are then instructed to delete the information from your computer. Thank you for your cooperation.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: replace HQ images

iText Info
Op 7/06/2012 15:11, Jason Berk schreef:
> Any suggestions?
Yes, there's an example on how to downsize images in the book on p528.
You can find the corresponding code here: http://1t3xt.be/?179

Note that this example uses 'brute force' to find images.
You may want to adapt the code to find the images through the XObjects
in the Resources of page dictionaries and XObject dictionaries.

Basically, you give a PDF stream to iText's PdfImageObject class, and
this class will return an instance of Java's BufferedImage.
Changing the resolution of the image is done using methods available in
the Java SDK.
Then you can write the image to an array of bytes (in the example:
encoded as JPG).

These bytes can be used to alter the image stream (as JPG images are
stored AS-IS inside PDF, this isn't the case with some other image formats).

Note that you're a paying customer, so you can also use the closed mail
address if you have further questions.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: replace HQ images

Wain, Matthew
Sorry to mail hijack.... my company is a paying customer (check mail
address), I wasn't even aware that there was a closed list? (other than
the 'support' email address).

Thanks,
Matthew

-----Original Message-----
From: iText Info [mailto:[hidden email]]
Sent: 07 June 2012 15:12
To: Post all your questions about iText here
Subject: Re: [iText-questions] replace HQ images

Op 7/06/2012 15:11, Jason Berk schreef:
> Any suggestions?
Yes, there's an example on how to downsize images in the book on p528.
You can find the corresponding code here: http://1t3xt.be/?179

Note that this example uses 'brute force' to find images.
You may want to adapt the code to find the images through the XObjects
in the Resources of page dictionaries and XObject dictionaries.

Basically, you give a PDF stream to iText's PdfImageObject class, and
this class will return an instance of Java's BufferedImage.
Changing the resolution of the image is done using methods available in
the Java SDK.
Then you can write the image to an array of bytes (in the example:
encoded as JPG).

These bytes can be used to alter the image stream (as JPG images are
stored AS-IS inside PDF, this isn't the case with some other image
formats).

Note that you're a paying customer, so you can also use the closed mail
address if you have further questions.

------------------------------------------------------------------------
------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will
include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Land Registry's House Price Index is now live. www.landregistry.gov.uk


If you have received this e-mail and it was not intended for you, please let us know, and then delete it. Please treat our communications in confidence,
as you would expect us to treat yours. Land Registry checks all mail and attachments for known viruses, however, you are advised that you open any
attachments at your own risk.


The original of this email was scanned for viruses by the Government Secure Intranet virus scanning service supplied by Cable&Wireless Worldwide in partnership with MessageLabs. (CCTM Certificate Number 2009/09/0052.) On leaving the GSi this email was certified virus free.
Communications via the GSi may be automatically logged, monitored and/or recorded for legal purposes.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: replace HQ images

iText Info
Op 7/06/2012 16:51, Wain, Matthew schreef:
> Sorry to mail hijack.... my company is a paying customer (check mail
> address), I wasn't even aware that there was a closed list? (other than
> the 'support' email address).
Yes, when you received the EULA, you were asked to provide a number of
email adresses (up to three).
These e-mail addresses are whitelisted on a closed address.
In your case, we only have one address (initials LC).

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: replace HQ images

Wain, Matthew
Thank you.

He sits right by me... I'll try and get the relevant people added (maybe
me).

-----Original Message-----
From: iText Info [mailto:[hidden email]]
Sent: 07 June 2012 16:26
To: Post all your questions about iText here
Subject: Re: [iText-questions] replace HQ images

Op 7/06/2012 16:51, Wain, Matthew schreef:
> Sorry to mail hijack.... my company is a paying customer (check mail
> address), I wasn't even aware that there was a closed list? (other
> than the 'support' email address).
Yes, when you received the EULA, you were asked to provide a number of
email adresses (up to three).
These e-mail addresses are whitelisted on a closed address.
In your case, we only have one address (initials LC).

------------------------------------------------------------------------
------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will
include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Land Registry's House Price Index is now live. www.landregistry.gov.uk


If you have received this e-mail and it was not intended for you, please let us know, and then delete it. Please treat our communications in confidence,
as you would expect us to treat yours. Land Registry checks all mail and attachments for known viruses, however, you are advised that you open any
attachments at your own risk.


The original of this email was scanned for viruses by the Government Secure Intranet virus scanning service supplied by Cable&Wireless Worldwide in partnership with MessageLabs. (CCTM Certificate Number 2009/09/0052.) On leaving the GSi this email was certified virus free.
Communications via the GSi may be automatically logged, monitored and/or recorded for legal purposes.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[hidden email]
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
Loading...