Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media=prepress fails to be processed by Kindle Publishing #2477

Closed
mementum opened this issue Jan 15, 2024 · 8 comments
Closed

media=prepress fails to be processed by Kindle Publishing #2477

mementum opened this issue Jan 15, 2024 · 8 comments
Assignees
Milestone

Comments

@mementum
Copy link

media values of screen and print do upload and are processed with no problem.

prepress will be rejected. After adding an optimization pass with rghost (and obviously ghostcript in the background) it does then upload. I also tried the Foxit PDF Editor, applying only the cleanup optimization and it also did something which made the format good for Kindle Publishing.

Understanding that finding a very small thing in the PDF generation that could be slightly different could be a huge effort, I would propose that a small hint be added to the documentation, pointing that in case of any problem with the prepress media mode, an optimization pass can iron things out.

Best regards

@mojavelinux
Copy link
Member

This looks like a duplicate of #2476.

I would propose that a small hint be added to the documentation, pointing that in case of any problem with the prepress media mode, an optimization pass can iron things out.

I'm open to accepting a pull request to add this information to the documentation.

@meonkeys
Copy link
Contributor

meonkeys commented Jan 17, 2024

@mementum you can try this workaround. I used it to get a prepress PDF working with Lulu.

Credit to @mojavelinux for the idea.

@mojavelinux
Copy link
Member

If we can confirm with local tools that this indeed fixes the validation error, we could consider adding this into the converter when media=prepress. But we have to be able to test it locally.

@meonkeys
Copy link
Contributor

meonkeys commented Jan 18, 2024

pdftotext appears to be happy with the workaround, as discussed in chat.

I'm using pdftotext version 22.02.0. Came to my workspace via poppler-utils 22.02.0-2ubuntu0.3 on Ubuntu 22.04.3 LTS 64-bit desktop.

meonkeys added a commit to meonkeys/shb that referenced this issue Jan 18, 2024
* put typeset output files in the same dir (nice and easy, no need to jump around to another folder to find the outputs)
* don't use rake, it doesn't add anything (and I'm not familiar with it)
* tidy up build output, 'cause I'm neat like that 🧹
* upgrade asciidoctor-epub3 to latest available
* move some stuff about building the book from the book itself into a new readme since it feels likely to change
* use volumes instead of COPY (simplifies and speeds up the build)
* fix a Lulu prepress PDF validation issue -- see:
    * <asciidoctor/asciidoctor-pdf#2476>
    * <asciidoctor/asciidoctor-pdf#2477>
    * <https://asciidoctor.zulipchat.com/#narrow/stream/288690-users.2Fasciidoctor-pdf/topic/syntax.20error.20with.20prepress.20PDF>
    * </~https://github.com/meonkeys/print-this/>
@mojavelinux
Copy link
Member

mojavelinux commented Jan 18, 2024

Working with meonkeys, I've been able to confirm that this is, in fact, a bug. What's happening is that fill and stroke color commands are being issued without first defining the color space. This occurs when running content is added to an otherwise empty page. (The commands try to set the color of something, but the color space is not defined as either DeviceRGB or DeviceCMYK. That's what it means by incorrect number of arguments for scn/SCN. I think it must default to DeviceCMYK, and an RGB color is one less argument than CMYK).

Here's the point at which I discovered the issue:

Prawn does not check whether the color space has been set when setting up the graphic state for a stamp (running content is implemented as a stamp). So it ends up setting things like the line and stroke color without initializing the graphic state on empty pages.

Ultimately a bug in Prawn. However, the workaround to set the color space if otherwise empty before writing any running content is straightforward and future proof, so we'll just go with that.

@mojavelinux mojavelinux self-assigned this Jan 18, 2024
@mojavelinux mojavelinux added this to the v2.3.x milestone Jan 18, 2024
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jan 19, 2024
… graphic state for stamp

- clear graphic state on repeater so that the graphic state of the current page is saved instead
- remove obsolete workaround to set color space on pages with images
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jan 19, 2024
… graphic state for stamp

- clear graphic state on repeater so that the graphic state of the current page is saved instead
- remove obsolete workaround to set color space on pages with images
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jan 19, 2024
… graphic state for stamp

- clear graphic state on repeater so that the graphic state of the current page is saved instead
- remove obsolete workaround to set color space on pages with images
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jan 20, 2024
… graphic state for stamp

- map color_space from graphic state on repeater to color space of current page so color space is set properly
- remove obsolete workaround to set color space on pages with images
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jan 20, 2024
… graphic state for stamp

- map color_space from graphic state on repeater to color space of current page so color space is set properly
- remove obsolete workaround to set color space on pages with images
mojavelinux added a commit that referenced this issue Jan 20, 2024
…aphic state for stamp

- map color_space from graphic state on repeater to color space of current page so color space is set properly
- remove obsolete workaround to set color space on pages with images
meonkeys added a commit to meonkeys/shb that referenced this issue Jan 20, 2024
* put typeset output files in the same dir (nice and easy, no need to jump around to another folder to find the outputs)
* don't use rake, it doesn't add anything (and I'm not familiar with it)
* tidy up build output, 'cause I'm neat like that 🧹
* upgrade asciidoctor-epub3 to latest available
* move some stuff about building the book from the book itself into a new readme since it feels likely to change
* use volumes instead of COPY (simplifies and speeds up the build)
* fix a Lulu prepress PDF validation issue -- see:
    * <asciidoctor/asciidoctor-pdf#2476>
    * <asciidoctor/asciidoctor-pdf#2477>
    * <https://asciidoctor.zulipchat.com/#narrow/stream/288690-users.2Fasciidoctor-pdf/topic/syntax.20error.20with.20prepress.20PDF>
    * </~https://github.com/meonkeys/print-this/>
meonkeys added a commit to meonkeys/shb that referenced this issue Jan 20, 2024
* put typeset output files in the same dir (nice and easy, no need to jump around to another folder to find the outputs)
* don't use rake, it doesn't add anything (and I'm not familiar with it)
* tidy up build output, 'cause I'm neat like that 🧹
* upgrade asciidoctor-epub3 to latest available
* move some stuff about building the book from the book itself into a new readme since it feels likely to change
* use volumes instead of COPY (simplifies and speeds up the build)
* fix a Lulu prepress PDF validation issue -- see:
    * <asciidoctor/asciidoctor-pdf#2476>
    * <asciidoctor/asciidoctor-pdf#2477>
    * <https://asciidoctor.zulipchat.com/#narrow/stream/288690-users.2Fasciidoctor-pdf/topic/syntax.20error.20with.20prepress.20PDF>
    * </~https://github.com/meonkeys/print-this/>
@mementum
Copy link
Author

Thanks for the fix.

@mementum
Copy link
Author

Let me add positive feedback now that version 2.3.11 has been released: media=prepress is accepted by KDP.

@mojavelinux
Copy link
Member

Thanks for sharing @mementum! This makes me very happy. 🕺

meonkeys added a commit to meonkeys/shb that referenced this issue Jan 25, 2024
Removes the need for ink_running_content override. Yay!

See: asciidoctor/asciidoctor-pdf#2477
meonkeys added a commit to meonkeys/print-this that referenced this issue Jan 25, 2024
Removes the need for ink_running_content override. Yay!

See: asciidoctor/asciidoctor-pdf#2477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants