You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Thiruppathi M." <th...@sps.co.in> on 2016/12/16 14:18:38 UTC

overlap issue

Hi,


The sentence doesn't appear properly in PDF when delete and insert the new sentence.

This is the code:

String newSentence = "Materials Today: Proceedings "+ volume_number+" ("+strYear+ ") "+ First_Page_Number+"-"+Last_Page_Number";

array.add(new COSString(newSentence));

tokens.add(stvalue-1, array);

Refer the below output,


[cid:image001.png@01D257D5.6364D9D0]




3268 is overlapped on ndash. Please advice how to resolve this issue.


Regards
Thiruppathi M.


Re: overlap issue

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 17.12.2016 um 09:59 schrieb Thiruppathi M.:
> Hi,
>
> Herewith I have enclosed the PDF input and output as images for your reference.

This didn't get through. Attachments get blocked most of the time.

>
> I have to remove the sentence "00 (2015) 000-000" and insert the new sentence with appropriate values.
>
> It was updated correctly and I am facing the below issue,
>
> 1. The ndash (-) in the page range was getting overlapped with the next character after the conversion.
> Please refer PDF_output.png. eg.3622-3628
>
>
> a. [You have a tokens object (what type?)]
> 	
> 		This is the tokens object sample code.
>
> 				PDDocument doc = PDDocument.load( "input.pdf" );
> 				List pages = doc.getDocumentCatalog().getAllPages();
> 				PDPage page = (PDPage)pages.get( 1);
> 		            	PDStream contents = page.getContents();
> 		
> 		            	PDFStreamParser parser = new PDFStreamParser(contents.getStream());
> 		            	parser.parse();
> 		
> 		            	List tokens = parser.getTokens();
>
>
> b. [You have a tokens object (what type?)]
> 			
> 		  The code for array,
>
> 				COSArray array = new COSArray();
> 				String newSentence = "Materials Today: Proceedings "+ volume_number+"("+strYear+ ") "+ First_Page_Number+"-"+Last_Page_Number";
> 				array.add(new COSString(newSentence));
> 				tokens.add(stvalue-1, array);
>
> Please advice how to proceed further.

OK, so what really happened is that you were trying to use the 
ReplaceText example to replace some text. Read at the end of

https://pdfbox.apache.org/2.0/migration.html
"Why was the ReplaceText example removed?

You are now having exactly the problem we're talking about. PDF isn't 
made for editing.

To understand this, what you could do is to use the WriteDecodedDoc 
command line utility. You can then edit the PDF with NOTEPAD++. Be 
careful not to change any offsets, i.e. the byte position of "endstream" 
must stay the same. But you can now try to change the numbers of positions.

Tilman


>
> Regards
> Thiruppathi M.
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: 16 December 2016 PM 08:53
> To: users@pdfbox.apache.org
> Subject: Re: overlap issue
>
> Am 16.12.2016 um 15:18 schrieb Thiruppathi M.:
>> Hi,
>>
>> The sentence doesn't appear properly in PDF when delete and insert the
>> new sentence.
>>
>> This is the code:
>>
>> String newSentence = "Materials Today: Proceedings "+ volume_number+"
>> ("+strYear+ ") "+ First_Page_Number+"-"+Last_Page_Number";
>>
>> array.add(new COSString(newSentence));
>>
>> tokens.add(stvalue-1, array);
>>
>> Refer the below output,
>>
> The image didn't get through. And I have no idea what you want to do.
> You have a tokens object (what type?) to which you added a value and an
> array. For what?
>
> Tilman
>
>> 3268 is overlapped on ndash. Please advice how to resolve this issue.
>>
>> Regards
>>
>> Thiruppathi M.
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org



RE: overlap issue

Posted by "Thiruppathi M." <th...@sps.co.in>.
Hi,

Herewith I have enclosed the PDF input and output as images for your reference.

I have to remove the sentence "00 (2015) 000-000" and insert the new sentence with appropriate values.

It was updated correctly and I am facing the below issue,

1. The ndash (-) in the page range was getting overlapped with the next character after the conversion.
Please refer PDF_output.png. eg.3622-3628 


a. [You have a tokens object (what type?)]
	
		This is the tokens object sample code.

				PDDocument doc = PDDocument.load( "input.pdf" );
				List pages = doc.getDocumentCatalog().getAllPages();
				PDPage page = (PDPage)pages.get( 1);
		            	PDStream contents = page.getContents();
		                
		            	PDFStreamParser parser = new PDFStreamParser(contents.getStream());
		            	parser.parse();
		            
		            	List tokens = parser.getTokens();


b. [You have a tokens object (what type?)]
			
		  The code for array, 

				COSArray array = new COSArray();
				String newSentence = "Materials Today: Proceedings "+ volume_number+"("+strYear+ ") "+ First_Page_Number+"-"+Last_Page_Number";
				array.add(new COSString(newSentence));
				tokens.add(stvalue-1, array);

Please advice how to proceed further.

Regards
Thiruppathi M.

-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: 16 December 2016 PM 08:53
To: users@pdfbox.apache.org
Subject: Re: overlap issue

Am 16.12.2016 um 15:18 schrieb Thiruppathi M.:
>
> Hi,
>
> The sentence doesn't appear properly in PDF when delete and insert the 
> new sentence.
>
> This is the code:
>
> String newSentence = "Materials Today: Proceedings "+ volume_number+" 
> ("+strYear+ ") "+ First_Page_Number+"-"+Last_Page_Number";
>
> array.add(new COSString(newSentence));
>
> tokens.add(stvalue-1, array);
>
> Refer the below output,
>

The image didn't get through. And I have no idea what you want to do. 
You have a tokens object (what type?) to which you added a value and an 
array. For what?

Tilman

> 3268 is overlapped on ndash. Please advice how to resolve this issue.
>
> Regards
>
> Thiruppathi M.
>



Re: overlap issue

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 16.12.2016 um 15:18 schrieb Thiruppathi M.:
>
> Hi,
>
> The sentence doesnt appear properly in PDF when delete and insert the 
> new sentence.
>
> This is the code:
>
> String newSentence = "Materials Today: Proceedings "+ volume_number+" 
> ("+strYear+ ") "+ First_Page_Number+"-"+Last_Page_Number;
>
> array.add(new COSString(newSentence));
>
> tokens.add(stvalue-1, array);
>
> Refer the below output,
>

The image didn't get through. And I have no idea what you want to do. 
You have a tokens object (what type?) to which you added a value and an 
array. For what?

Tilman

> 3268 is overlapped on ndash. Please advice how to resolve this issue.
>
> Regards
>
> Thiruppathi M.
>