Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A2386683B for ; Thu, 16 Jun 2011 18:30:25 +0000 (UTC) Received: (qmail 77680 invoked by uid 500); 16 Jun 2011 18:30:25 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 77655 invoked by uid 500); 16 Jun 2011 18:30:25 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 77643 invoked by uid 99); 16 Jun 2011 18:30:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 18:30:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of heshamgneady@gmail.com designates 74.125.82.176 as permitted sender) Received: from [74.125.82.176] (HELO mail-wy0-f176.google.com) (74.125.82.176) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 18:30:20 +0000 Received: by wyb40 with SMTP id 40so1769968wyb.21 for ; Thu, 16 Jun 2011 11:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:from:to:references:in-reply-to :subject:date:mime-version:content-type:content-transfer-encoding :x-priority:x-msmail-priority:importance:x-mailer:x-mimeole; bh=UxW3nvATq43K6bJjHh4OD4njW6Ly9F4pN2rgdXH5ql0=; b=dLKQ8/LqKCJFfVZr3qEn6VtO2KqpjaYeECnwF74tq2vSn0b/SFIhTXwAaD7RXQIPP4 nO04zddX3UqnD+x3rhZY7W7f2JbbktaVf4gH7y/KZ3z7FOqSaZiXGefG+oNHbTiS6tNA sz13qiZnOugvo+NdztruJ/lmfGME3k2MLttSQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:references:in-reply-to:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :importance:x-mailer:x-mimeole; b=TlWcyp4U9KNAYzo+svd/42jik0ZcxvKDVMn/NdUcJf/AFhQJSTbdrM0//6oqt8bL0g WOl2Z5XRdXtMoS7V9yR3qm0I9FfioEzlK9faPDErIlyVx5ZKeLd51FiHmetx+UzCf+cW IkPsCj4jzknKKpLbzavfOl8ez2K27DTYGPaZ4= Received: by 10.216.237.8 with SMTP id x8mr1343836weq.37.1308248998380; Thu, 16 Jun 2011 11:29:58 -0700 (PDT) Received: from your2f73f42422 ([41.234.139.210]) by mx.google.com with ESMTPS id z22sm995402weq.2.2011.06.16.11.29.47 (version=SSLv3 cipher=OTHER); Thu, 16 Jun 2011 11:29:57 -0700 (PDT) Message-ID: <334F9A01360646789EFBA1863570ED51@your2f73f42422> From: "Hesham G." To: References: <1C521B9263A74ECC9846D517814DD7EE@HeshamLaptop> <535493F45A5442DDA133D61F41F0D222@your2f73f42422> <8190DB44A9F544AA9383B9D60256B628@your2f73f42422> In-Reply-To: Subject: Re: Is there a difference between Watermark & Stamp ? Date: Thu, 16 Jun 2011 20:29:39 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 14.0.8117.416 X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8117.416 Thanks Adam and Andrey ... I will start reading that now. Best regards , Hesham --------------------------------------------- Included message : > Reading the PDF spec (PDF 32000-1:2008) is how I learned. I'd recommend > starting with section 7.1 (which is only one page), and then going > straight to section 7.7 (Document Structure) and referencing other > sections as you go along. Section 7.5 (File Structure) is also an > interesting read. For example 7.5.5 says "Conforming readers should read > a PDF file from its end." Once you know this, you can do the same thing > that all PDF software does (or at least, what they should be doing). > > Hope this helps get you started. Happy reading. > > ---- > Thanks, > Adam > > > > From: > "Hesham G." > To: > > Date: > 06/16/2011 11:09 > Subject: > Re: Is there a difference between Watermark & Stamp ? > > > > Adam , > > Thanks a lot for the nice tips. > > I really would like to start learning how to read PDF code to trace it. I > have searched for any books or tutorials explaining that, but I couldn't > find any. > > > Best regards , > Hesham > > --------------------------------------------- > Included message : > > >> I downloaded your file and uncompressed it using pdftk. After that I > just >> opened it with a text editor and looked for anything which might be >> interesting. >> >> I found that there's an element which mentions something about an image >> and transparency. >> 2 0 obj >> << >> /Rotate 0 >> /pdftk_PageNum 1 >> /CropBox [0 0 612 792] >> /MediaBox [0 0 612 792] >> /Resources >> << >> /ExtGState >> << >> /GS8 21 0 R >> /GS5 22 0 R >> >> >> /Font >> << >> /F1 23 0 R >> >> >> /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] >> >> >> /Parent 1 0 R >> /Contents [24 0 R 25 0 R 26 0 R 27 0 R 28 0 R 29 0 R 30 0 R 31 0 >> R] >> /StructParents 0 >> /Type /Page >> /Group >> << >> /CS /DeviceRGB >> /Type /Group >> /S /Transparency >> >> >> /Tabs /S >>>> >> endobj >> >> Tracing back, it turns out that this is the page element ("20 0" is the >> root, "1 0" is the element which defines the pages, and "2 0" is page > 1). >> Now the /Contents of the page are what we're interested in, but >> unfortunately they are all streams of data which means very little to > me. >> I'm not sure if these are object streams, but I'd imagine so because > there >> doesn't seem to be any indication of the type. If you can find a way to >> get these in a more human-readable format, you should be able to > continue >> reverse engineering the PDF to determine how the image is on there. Once >> you know that, you'll know exactly what you want to do. Then it should >> just be a matter of checking the PDF reference to fully understand > what's >> going on and what output you need from PDFBox. It's important you get >> comfortable with tracing through a PDF in a text editor; this is the > only >> way you'll be able to track down issues. >> >> I usually just search the PDF source for the keyword that I'm looking > for >> when I'm looking for a new feature and then trace the code back to try > to >> understand how it is used and what the key classes are. Once I know > what >> classes to use, I hit the documentation and search the Internet for >> examples. If that doesn't work, check the user mailing list and see if >> anyone has any suggestions. If not, check the dev mailing list to see > if >> the functionality currently exists and if not, if anyone has any >> suggestions on where you should implement it. >> >> ---- >> Thanks, >> Adam >> >> >> >> >> >> From: >> "Hesham G." >> To: >> >> Date: >> 06/16/2011 07:34 >> Subject: >> Re: Is there a difference between Watermark & Stamp ? >> >> >> >> Adam , >> >> This post is old, but I am still facing problems using the watermark, > and >> I need it badly. >> >> I have created a Microsoft word doc file with a watermark and I saved it >> as a PDF file, and it appears just as I want. Now I am looking for a way >> for how to do this with PDFBox. You can check this 1 page sample PDF : >> http://www.4shared.com/document/rQ2berMh/pdf_with_watermark.html >> >> Any help would be appreciated. >> >> >> Best regards , >> Hesham >> >> --------------------------------------------- >> Included message : >> >>> Sorry, but I can't give you any code examples for I have never done any >>> work with stamps nor watermarks. All I did was read the manual because >>> when I saw your question I thought "Hmm, that's a good question!" >>> >>> What you describe sounds correct in terms of how it works, but it looks >>> like there is also an option to have the watermark not appear at all on >>> the PDF (when rendered on the screen), but appear when it is printed. >> I'm >>> not sure if that's something you are interested in, but it's an option >> as >>> far as I can tell. >>> >>> Your best bet would be to find a PDF with a watermark, then extract a >>> single page. This will give you a small PDF with a watermark and you >>> should be able to go through it by hand (i.e. a good text editor). Just >> >>> search for "watermark" and see what comes up and then when you find >>> something in the PDF, see what references it and check the spec to get >>> some more information about what you're looking at. For example, if > you >> >>> see object "72 0" is a watermark, search for things which reference 72 >> 0. >>> If you keep doing this you'll eventually get back to the root. If you >>> keep notes, you should have a nice map of how everything is connected. >>> I've done this for other objects and in combination with the spec, it's >>> worked out pretty well. Remember, you can also make modifications to >> the >>> PDF using a text editor to see what it does (just remember to back up >> the >>> original before you go hacking up the PDF or you'll probably end up > with >> a >>> corrupt document). >>> >>> ---- >>> Thanks, >>> Adam >>> >>> >>> >>> From: >>> "Hesham G." >>> To: >>> >>> Date: >>> 11/11/2010 03:15 >>> Subject: >>> Re: Is there a difference between Watermark & Stamp ? >>> >>> >>> >>> Adam , >>> >>> Thanks a lot for you reply, and sorry for being that late ... You're >>> always >>> here Adam when I need an answer. >>> >>> I have this in PDF reference 1.7, but I do not understand that Adobe >> code >>> :) >>> If you can translate this to me or give me a PDFBox code example, that >>> will >>> be very helpful. >>> >>> In general, what I understand is that both watermarks and stamps both >> can >>> be >>> images that appear in the PDF, but a watermark will appear in the >>> background, so if there was a text above it, the text will appear >>> normally. >>> In addition a watermark will appear as a part of the page, so it can't >> be >>> clicked to show a notice box, as happens in a Stamp. >>> >>> If this is wrong I hope you can correct me. if it's right, then >> watermarks >>> >>> is what I am looking for. >>> >>> Best regards , >>> Hesham >>> >>> --------------------------------------------- >>> Included message : >>> >>>> Hesham, >>>> >>>> Take a look at table 102 in section 8.11.4.4 (Usage and Usage >>> Application >>>> Dictionaries) of the PDF spec (I'm looking at version 1.7). >>>> "A dictionary specifying that the content in this group is shall be >> used >>>> when printing. It may contain the following optional entries: >>>> Subtype A name object specifying the kind of content controlled by the >>>> group; for example, Trapping, PrintersMarks and Watermark. >>>> PrintState A name that shall be either ON or OFF, indicating that the >>>> group shall be set to that state when the document is printed from a >>>> conforming reader." >>>> >>>> For more information on the subtypes, see section 12.5.6.1, and >>> 12.5.6.22 >>>> for specific details about a watermark. >>>> >>>> I didn't read all the sections I just references, but after a quick >>> look, >>>> it seems the main difference is that watermarks only appear on printed >>>> documents, where images would appear when viewing the document as > well. >>>> PDFBox might already support watermarks, but if it doesn't it could >>>> probably be added without too much difficulty. Section 12.5.6.22 has > a >>>> nice example of how it's laid out in the PDF which you could > reference. >>>> You could also use that to either verify that your test document >>> actually >>>> has a real watermark, or to manually add a watermark to one of your >> test >>>> documents. >>>> >>>> ---- >>>> Thanks, >>>> Adam >>>> >>>> >>>> ----- Forwarded by Adam Nichols/UR/CER/XLDynamics on 11/09/2010 12:04 >>>> ----- >>>> >>>> From: >>>> Adam Nichols/UR/CER/XLDynamics >>>> To: >>>> users@pdfbox.apache.org >>>> Cc: >>>> "pdfbox-send-question" >>>> Date: >>>> 11/08/2010 09:13 >>>> Subject: >>>> Re: Is there a difference between Watermark & Stamp ? >>>> >>>> >>>> Take a look at table 102 in section 8.11.4.4 (Usage and Usage >>> Application >>>> Dictionaries) of the PDF spec (I'm looking at version 1.7). >>>> "A dictionary specifying that the content in this group is shall be >> used >>>> when printing. It may contain the following optional entries: >>>> Subtype A name object specifying the kind of content controlled by the >>>> group; for example, Trapping, PrintersMarks and Watermark. >>>> PrintState A name that shall be either ON or OFF, indicating that the >>>> group shall be set to that state when the document is printed from a >>>> conforming reader." >>>> >>>> For more information on the subtypes, see section 12.5.6.1, and >>> 12.5.6.22 >>>> for specific details about a watermark. >>>> >>>> I didn't read all the sections I just references, but after a quick >>> look, >>>> it seems the main difference is that watermarks only appear on printed >>>> documents, where images would appear when viewing the document as > well. >>>> PDFBox might already support watermarks, but if it doesn't it could >>>> probably be added without too much difficulty. Section 12.5.6.22 has > a >>>> nice example of how it's laid out in the PDF which you could > reference. >>>> You could also use that to either verify that your test document >>> actually >>>> has a real watermark, or to manually add a watermark to one of your >> test >>>> documents. >>>> >>>> ---- >>>> Thanks, >>>> Adam >>>> >>>> >>>> >>>> From: >>>> "Hesham G." >>>> To: >>>> "pdfbox-send-question" >>>> Date: >>>> 11/07/2010 00:53 >>>> Subject: >>>> Is there a difference between Watermark & Stamp ? >>>> >>>> >>>> >>>> Hello everyone , >>>> >>>> What is the difference between a watermark and a stamp in PDF ? >>>> I have seen nice examples in PDFBox to create stamps, but none to >> create >>>> watermarks. I guess it is not supported yet ! >>>> >>>> >>>> Best regards , >>>> Hesham >>>> >>>> >>>> >>>> >>>> >>>> - FHA 203b; 203k; HECM; VA; USDA; Conventional >>>> - Warehouse Lines; FHA-Authorized Originators >>>> - Lending and Servicing in over 45 States >>>> www.swmc.com - www.simplehecmcalculator.com >>>> Visit www.swmc.com/resources for helpful links on Training, >> Webinars, >>> >>>> Lender Alerts and Submitting Conditions >>>> >>>> This email and any content within or attached hereto from Sun West >>>> Mortgage Company, Inc. is confidential and/or legally privileged. The >>>> information is intended only for the use of the individual or entity >>> named >>>> on this email. If you are not the intended recipient, you are hereby >>>> notified that any disclosure, copying, distribution or taking any >> action >>> >>>> in reliance on the contents of this email information is strictly >>>> prohibited, and that the documents should be returned to this office >>>> immediately by email. Receipt by anyone other than the intended >>> recipient >>>> is not a waiver of any privilege. Please do not include your social >>>> security number, account number, or any other personal or financial >>>> information in the content of the email. Should you have any > questions, >> >>>> please call (800) 453 7884. = >>> >>> >>> >>> >>> >>> >>> - FHA 203b; 203k; HECM; VA; USDA; Conventional >>> - Warehouse Lines; FHA-Authorized Originators >>> - Lending and Servicing in over 45 States >>> www.swmc.com - www.simplehecmcalculator.com >>> Visit www.swmc.com/resources for helpful links on Training, > Webinars, >> Lender Alerts and Submitting Conditions >>> >>> This email and any content within or attached hereto from Sun West >> Mortgage Company, Inc. is confidential and/or legally privileged. The >> information is intended only for the use of the individual or entity > named >> on this email. If you are not the intended recipient, you are hereby >> notified that any disclosure, copying, distribution or taking any action >> in reliance on the contents of this email information is strictly >> prohibited, and that the documents should be returned to this office >> immediately by email. Receipt by anyone other than the intended > recipient >> is not a waiver of any privilege. Please do not include your social >> security number, account number, or any other personal or financial >> information in the content of the email. Should you have any questions, >> please call (800) 453 7884. = >> >> >> - FHA 203b; 203k; HECM; VA; USDA; Conventional >> - Warehouse Lines; FHA-Authorized Originators >> - Lending and Servicing in over 45 States >> www.swmc.com - www.simplehecmcalculator.com Visit >> www.swmc.com/resources for helpful links on Training, Webinars, Lender > >> Alerts and Submitting Conditions >> This email and any content within or attached hereto from Sun West >> Mortgage Company, Inc. is confidential and/or legally privileged. The >> information is intended only for the use of the individual or entity > named >> on this email. If you are not the intended recipient, you are hereby >> notified that any disclosure, copying, distribution or taking any action > >> in reliance on the contents of this email information is strictly >> prohibited, and that the documents should be returned to this office >> immediately by email. Receipt by anyone other than the intended > recipient >> is not a waiver of any privilege. Please do not include your social >> security number, account number, or any other personal or financial >> information in the content of the email. Should you have any questions, >> please call (800) 453 7884. > > > > > - FHA 203b; 203k; HECM; VA; USDA; Conventional > - Warehouse Lines; FHA-Authorized Originators > - Lending and Servicing in over 45 States > www.swmc.com - www.simplehecmcalculator.com Visit > www.swmc.com/resources for helpful links on Training, Webinars, Lender > Alerts and Submitting Conditions > This email and any content within or attached hereto from Sun West > Mortgage Company, Inc. is confidential and/or legally privileged. The > information is intended only for the use of the individual or entity named > on this email. If you are not the intended recipient, you are hereby > notified that any disclosure, copying, distribution or taking any action > in reliance on the contents of this email information is strictly > prohibited, and that the documents should be returned to this office > immediately by email. Receipt by anyone other than the intended recipient > is not a waiver of any privilege. Please do not include your social > security number, account number, or any other personal or financial > information in the content of the email. Should you have any questions, > please call (800) 453 7884.