Git Product home page Git Product logo

Comments (7)

michaelrsweet avatar michaelrsweet commented on September 28, 2024

Regarding the first issue, look for errors from pdftoppm (from Poppler or Xpdf) - there are some known compatibility issues.

Regarding the PCL output, "ESC*r0B" is correct and PCL Paraphernalia is wrong - PCL 3 and 4 had an argument for the end raster graphics command while PCL 5 does not. For maximum compatibility, we need to keep the "0" argument in there.

from ippsample.

AFischer4 avatar AFischer4 commented on September 28, 2024

No it’s not pdftoppm alone. I tried different pdf files from different producers and calling pdftoppm from the command line is sending valid grafic data.
And you won’t notice the error, until you try to use ipptransform as man-in-the-middle to directly stream the result from pdftoppm to the upper level ippserver via stdout.

I think the unidirectional pipe of popen() is overwriting the opposite direction.
To call pdftoppm all the arguments are passed by command line or environment, and the result is received via stdin. The opposite direction stdout is during this time overwritten with /dev/null?
That is the main reason, why ippserver only received 4 bytes of data.

Regarding the PCL output, ESC*r0B:
I started with PCL5 and didn’t know about differences in previous versions.
Besides PCL Paraphernalia another website didn’t mention the existence of differences to earlier versions.
Sorry for the noise.

from ippsample.

michaelrsweet avatar michaelrsweet commented on September 28, 2024

So the popen call will not affect the standard input/output/error file descriptors of the ipptransform process and so that isn't the issue. Can you provide a sample PDF file you are trying to convert to PCL and the configuration you are using with ippserver?

from ippsample.

AFischer4 avatar AFischer4 commented on September 28, 2024

Sorry, I was too busy and couldn't reply faster.
As I have noticed, there is a September-Update of ippsample which i used to recheck the problems.

It looks like to problem was actually several problems.

I attached the sample image, which made trouble, when I tested ipptransform on a RPi4 at the end of April.
It’s still causing troubles, but further down the road in pdftoppm.
(Maybe not your problem?!?)

But I couldn't reproduce missing PCL data after pdftoppm successfully converted PDF to graphics.
popen() problem disappeared?!?
Is this due to recent changes in ippsample or is it probably related to an update of my RPi4 environment?
My libc .so.6 points to libc-2.28.so, which is dated after my last test. (May 25, 2023)

For the following tests I’m calling ipptransform directly.
I tested pdftoppm from poppler and from xpdf package by replacing /usr/bin/pdftoppm with the appropriate binary:

Test with poppler 0.71 pdftoppm:
pi@server-10:~ $ /usr/bin/pdftoppm -v
pdftoppm version 0.71.0
Copyright 2005-2018 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
 
       pi@server-10:~ $ ./ipptransform -vvv -f j1_poppler.pcl -m application/vnd.hp-pcl ./1-img-20230421-wa0001_jpg.pdf
 
DEBUG: Preparing document 1: './1-img-20230421-wa0001_jpg.pdf' (application/pdf)
DEBUG: Opening prepared document 1: './1-img-20230421-wa0001_jpg.pdf'.
DEBUG: Document 1: pages 1 to 1.
DEBUG: Using page 1 (0x559995d3e0) of document 1, cell=1/1, current=0
DEBUG: Doing full layout of 1 pages.
DEBUG: Laying out page 1/1.
DEBUG: page_dict_cb(dict=0x559995e780, key="ExtGState", outpage=0x7fc457b110), type=5
DEBUG: page_dict_cb(dict=0x559995e780, key="ProcSet", outpage=0x7fc457b110), type=1
DEBUG: page_dict_cb(dict=0x559995e780, key="XObject", outpage=0x7fc457b110), type=5
DEBUG: iwidth=595, iheight=841, cwidth=559.843, cheight=771.024, rotate=false
DEBUG: Page 1, cell 1/1, cm=[0.916794 0 0 0.916794 24.8916 35.4331], input=0x559995d3e0
DEBUG: Opening content stream 1/1...
DEBUG: Opened stream 1, resmap[0]=(nil)
DEBUG: cupsColorSpace=18
DEBUG: cupsBitsPerColor=8
DEBUG: cupsBitsPerPixel=8
DEBUG: cupsNumColors=1
DEBUG: cupsWidth=2480
DEBUG: cupsHeight=3507
ATTR: job-impressions=1
ATTR: job-pages=1
ATTR: job-media-sheets=1
DEBUG: cupsPageSize=[595.276 841.89]
DEBUG: Using Poppler version of pdftoppm.
DEBUG: Running "pdftoppm -gray -aa no -r 300 -scale-to 3507 '/tmp/6c2296da.pdf'".
Syntax Error (198): Unknown compression method in flate stream
DEBUG: 'P5'
DEBUG: '[2480 3508](tel:2480 3508)'
DEBUG: '255'
DEBUG: width=2480, height=3508, bpp=1, ystart=0, yend=3507
ATTR: job-impressions-completed=1
ATTR: job-media-sheets-completed=1
 

I attached the produced output file j1_poppler.pcl, but the contents is not as expected!
(82 Bytes of PCL Header and Trailer only.)

Test with xpdf 4.04 pdftoppm:

pi@server-10:~ $ /usr/bin/pdftoppm -v
pdftoppm version 4.04 [www.xpdfreader.com]
Copyright 1996-2022 Glyph & Cog, LLC

pi@server-10:~ $ ./ipptransform -vvv -f j1_xpdf.pcl -m application/vnd.hp-pcl ./1-img-20230421-wa0001_jpg.pdf

DEBUG: Preparing document 1: './1-img-20230421-wa0001_jpg.pdf' (application/pdf)
DEBUG: Opening prepared document 1: './1-img-20230421-wa0001_jpg.pdf'.
DEBUG: Document 1: pages 1 to 1.
DEBUG: Using page 1 (0x55abb433e0) of document 1, cell=1/1, current=0
DEBUG: Doing full layout of 1 pages.
DEBUG: Laying out page 1/1.
DEBUG: page_dict_cb(dict=0x55abb44780, key="ExtGState", outpage=0x7fe93541b0), type=5
DEBUG: page_dict_cb(dict=0x55abb44780, key="ProcSet", outpage=0x7fe93541b0), type=1
DEBUG: page_dict_cb(dict=0x55abb44780, key="XObject", outpage=0x7fe93541b0), type=5
DEBUG: iwidth=595, iheight=841, cwidth=559.843, cheight=771.024, rotate=false
DEBUG: Page 1, cell 1/1, cm=[0.916794 0 0 0.916794 24.8916 35.4331], input=0x55abb433e0
DEBUG: Opening content stream 1/1...
DEBUG: Opened stream 1, resmap[0]=(nil)
DEBUG: cupsColorSpace=18
DEBUG: cupsBitsPerColor=8
DEBUG: cupsBitsPerPixel=8
DEBUG: cupsNumColors=1
DEBUG: cupsWidth=2480
DEBUG: cupsHeight=3507
ATTR: job-impressions=1
ATTR: job-pages=1
ATTR: job-media-sheets=1
DEBUG: cupsPageSize=[595.276 841.89]
DEBUG: Using Xpdf version of pdftoppm.
DEBUG: Running "pdftoppm -gray -aa no -r 300 '/tmp/e70f2187.pdf' -".
Syntax Warning (197): Unknown compression method [cmf1:0x0a 78] in flate stream
Syntax Error (198): Unknown compression method in flate stream [cmf:0x0a flag:0x78]
DEBUG: 'P5'
DEBUG: '[2480 3508](tel:2480 3508)'
DEBUG: '255'
DEBUG: width=2480, height=3508, bpp=1, ystart=0, yend=3507
ATTR: job-impressions-completed=1
ATTR: job-media-sheets-completed=1

I attached the produced output file j1_xpdf.pcl. It’s bigger this time, but the contents is still wrong.

After I applied the changes from the attached diff-File to xpdfio, I could see reasonable results.

pi@server-10:~ $ ./ipptransform -vvv -f j1_xpdf_patched.pcl -m application/vnd.hp-pcl ./1-img-20230421-wa0001_jpg.pdf

DEBUG: Preparing document 1: './1-img-20230421-wa0001_jpg.pdf' (application/pdf)
DEBUG: Opening prepared document 1: './1-img-20230421-wa0001_jpg.pdf'.
DEBUG: Document 1: pages 1 to 1.
DEBUG: Using page 1 (0x5584ed03e0) of document 1, cell=1/1, current=0
DEBUG: Doing full layout of 1 pages.
DEBUG: Laying out page 1/1.
DEBUG: page_dict_cb(dict=0x5584ed1780, key="ExtGState", outpage=0x7fd9904200), type=5
DEBUG: page_dict_cb(dict=0x5584ed1780, key="ProcSet", outpage=0x7fd9904200), type=1
DEBUG: page_dict_cb(dict=0x5584ed1780, key="XObject", outpage=0x7fd9904200), type=5
DEBUG: iwidth=595, iheight=841, cwidth=559.843, cheight=771.024, rotate=false
DEBUG: Page 1, cell 1/1, cm=[0.916794 0 0 0.916794 24.8916 35.4331], input=0x5584ed03e0
DEBUG: Opening content stream 1/1...
DEBUG: Opened stream 1, resmap[0]=(nil)
DEBUG: cupsColorSpace=18
DEBUG: cupsBitsPerColor=8
DEBUG: cupsBitsPerPixel=8
DEBUG: cupsNumColors=1
DEBUG: cupsWidth=2480
DEBUG: cupsHeight=3507
ATTR: job-impressions=1
ATTR: job-pages=1
ATTR: job-media-sheets=1
DEBUG: cupsPageSize=[595.276 841.89]
DEBUG: Using Xpdf version of pdftoppm.
DEBUG: Running "pdftoppm -gray -aa no -r 300 '/tmp/c2993ef3.pdf' -".
Syntax Warning (198): Unknown compression method [cmf1:0x0a 78] in flate stream
DEBUG: 'P5'
DEBUG: '[2480 3508](tel:2480 3508)'
DEBUG: '255'
DEBUG: width=2480, height=3508, bpp=1, ystart=0, yend=3507
ATTR: job-impressions-completed=1
ATTR: job-media-sheets-completed=1
ippprint.conf:
<…>
Command ipptransform
OutputFormat application/vnd.hp-pcl
DeviceURI socket://127.0.0.1:9100         
 

By the way:
DeviceURI [file://<jobname>.prn](file://%3cjobname%3e.prn) would be nice for testing but as far as I remember it’s not working.
The function httpSeparateURI(), which is is used to parse the URI was terminated with error „Invalid hostname“.
file:/<jobname>“ worked better but there is still some more work necessary…

1-img-20230421-wa0001_jpg.pdf

Sorry PCL files are missing because the were not accepted.
Not as .pcl and not as .zip.

from ippsample.

michaelrsweet avatar michaelrsweet commented on September 28, 2024

So I made one fix to ipptransform that could have affected the rendering of the content - the dither matrix used by the PCL code didn't always get initialized so it is possible that affected you.

Anyways, even using CoreGraphics on macOS I get a blank page with your sample file - investigating.

WRT file URLs, you need three slashes before the filename, e.g. file:///path/to/some/file, since the hostname portion is empty but you still need it.

from ippsample.

AFischer4 avatar AFischer4 commented on September 28, 2024

With the new version from September you only need additional changes to xpdf to analyze and correct the output of the example image above.
embedded_stream_with_CR_LF.diff.txt.patch

from ippsample.

michaelrsweet avatar michaelrsweet commented on September 28, 2024

OK, so that would be a PDFio issue that you previously reported against that project. I'll close this issue out and work to get the PDFio fix incorporated...

from ippsample.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.