[ 
https://issues.apache.org/jira/browse/PDFBOX-4897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon Steiner updated PDFBOX-4897:
----------------------------------
    Description: 
pdfbox 3 reads using offset in PDFObjectStreamParser

pdfbox 2 reads using object number in PDFObjectStreamParser, should this change 
be backported to help reading pdfs

 

I wrote a test case since i cant share my pdf

{color:#000080}public class {color}PDFObjectStreamParserTest {
 {color:#808000}@Test{color} {color:#000080}public void 
{color}testOffsetParsing() {color:#000080}throws {color}IOException {
 COSDictionary dict = {color:#000080}new {color}COSDictionary();
 dict.setItem(COSName.{color:#660e7a}N{color}, 
COSInteger.{color:#660e7a}ONE{color});
 COSStream stream = {color:#000080}new {color}COSStream(dict);
 OutputStream outputStream = stream.createUnfilteredStream();
 outputStream.write({color:#008000}"0 7 -1 true"{color}.getBytes());
 outputStream.close();
 PDFObjectStreamParser objectStreamParser = {color:#000080}new 
{color}PDFObjectStreamParser(stream, {color:#000080}null{color});
 objectStreamParser.parse();
 
Assert.assertEquals(objectStreamParser.getObjects().get({color:#0000ff}0{color}).getObject(),
 COSBoolean.{color:#660e7a}TRUE{color});
 }
 }

  was:
pdfbox 3 reads using offset in PDFObjectStreamParser

pdfbox 2 reads using object number in PDFObjectStreamParser, should this change 
be backported to help reading pdfs

 

{color:#000080}public class {color}PDFObjectStreamParserTest {
 {color:#808000}@Test
{color} {color:#000080}public void {color}testOffsetParsing() 
{color:#000080}throws {color}IOException {
 COSDictionary dict = {color:#000080}new {color}COSDictionary();
 dict.setItem(COSName.{color:#660e7a}N{color}, 
COSInteger.{color:#660e7a}ONE{color});
 COSStream stream = {color:#000080}new {color}COSStream(dict);
 OutputStream outputStream = stream.createUnfilteredStream();
 outputStream.write({color:#008000}"0 7 -1 true"{color}.getBytes());
 outputStream.close();
 PDFObjectStreamParser objectStreamParser = {color:#000080}new 
{color}PDFObjectStreamParser(stream, {color:#000080}null{color});
 objectStreamParser.parse();
 
Assert.assertEquals(objectStreamParser.getObjects().get({color:#0000ff}0{color}).getObject(),
 COSBoolean.{color:#660e7a}TRUE{color});
 }
}


> PDFObjectStreamParser doesnt use offset
> ---------------------------------------
>
>                 Key: PDFBOX-4897
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4897
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Simon Steiner
>            Priority: Major
>
> pdfbox 3 reads using offset in PDFObjectStreamParser
> pdfbox 2 reads using object number in PDFObjectStreamParser, should this 
> change be backported to help reading pdfs
>  
> I wrote a test case since i cant share my pdf
> {color:#000080}public class {color}PDFObjectStreamParserTest {
>  {color:#808000}@Test{color} {color:#000080}public void 
> {color}testOffsetParsing() {color:#000080}throws {color}IOException {
>  COSDictionary dict = {color:#000080}new {color}COSDictionary();
>  dict.setItem(COSName.{color:#660e7a}N{color}, 
> COSInteger.{color:#660e7a}ONE{color});
>  COSStream stream = {color:#000080}new {color}COSStream(dict);
>  OutputStream outputStream = stream.createUnfilteredStream();
>  outputStream.write({color:#008000}"0 7 -1 true"{color}.getBytes());
>  outputStream.close();
>  PDFObjectStreamParser objectStreamParser = {color:#000080}new 
> {color}PDFObjectStreamParser(stream, {color:#000080}null{color});
>  objectStreamParser.parse();
>  
> Assert.assertEquals(objectStreamParser.getObjects().get({color:#0000ff}0{color}).getObject(),
>  COSBoolean.{color:#660e7a}TRUE{color});
>  }
>  }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to