pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Add a transparent rectangle to the existed PDF with the co-ordinates.
Date Wed, 20 Mar 2013 06:08:09 GMT
Hi Eric,

            PDDocument document = PDDocument.load(provide filename, file ….);
            PDPage page = (PDPage) document.getDocumentCatalog().getAllPages().get(0);
            PDPageContentStream contentStream = new PDPageContentStream(document, page,true,true);
 //append the content stream
            contentStream.setStrokingColor(66, 177, 230);  
            contentStream.setStrokingColor(66, 177, 230);  
            contentStream.drawLine(100, 100, 200, 200);
            contentStream.fillRect(100, 100, 200, 200);
            contentStream.close();
            document.save(provide filename, file ….);
            document.close();


Maruan Sahyoun

Am 20.03.2013 um 02:53 schrieb Eric Chow <eric138@gmail.com>:

> Hi Maruan,
> 
> Thanks for your example. But I don't want to using annotation since it can
> be deleted.
> 
> I want to really highlight the text by giving the co-ordinate? Would you
> please to show me a simple example?
> 
> Best regards,
> Eric
> 
> 
> 
> 
> On Tue, Mar 19, 2013 at 3:21 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>wrote:
> 
>> Hi Eric,
>> 
>> I did something similar for one of our customers. I didn't use a rectangle
>> but a highlight annotation. A sample for annotations can be found at [1]
>> 
>> Kind regards
>> 
>> Maruan Sahyoun
>> 
>> 
>> http://svn.apache.org/repos/asf/pdfbox/branches/before-maven-layout/src/org/pdfbox/examples/pdmodel/Annotation.java
>> 
>> Am 19.03.2013 um 03:42 schrieb Eric Chow <eric138@gmail.com>:
>> 
>>> Hello,
>>> 
>>> How can I add a transparent yellow rectangle to a specific co-ordinate
>>> (llx, lly, urx, ury) into an existed PDF?
>>> 
>>> 
>>> In fact, I want to highlight some text that I know the exact position in
>>> the PDF. Would you please to teach me?
>>> 
>>> 
>>> Best regards,
>>> Eric
>> 
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message