Skip to content

feature: quick access to page 1 #1222

Open

Description

@izouxv

cover page is the first page of pdf

A new feature has been added to quickly export cover pages. This feature only supports quick export of cover pages. This can speed up the export of cover pages for large numbers of PDFs by loading only the xref objects involved in the cover page and then saving the cover page.

cover is the cover page of the PDF. Setting fastCover can quickly export the cover page of the PDF. For example, a 200MB PDF may contain many xref objects and may require 10K seed and read file operations. If fastCover is used, only a small number of xref objects involved in the cover may be loaded, and only 50 seed and read file operations may be required. This can significantly reduce the number of data operations, speed up the export of the cover page, and save memory, because only the cover page xref object data is in the memory.

Activity

  1. hhrutter commented on Sep 7, 2025

    @hhrutter
    Collaborator

    Although it works, your strategy to hack the page tree in order to keep all first kids of Pages entries is interesting.
    Since this is a rather specialized usecase I want to keep this out of the codebase at this point.
    The implementation also needs to be analysed thoroughly for side effects.

  2. changed the title [-]fast export cover page[/-] [+]Quick access to page 1[/+] on Sep 7, 2025
  3. changed the title [-]Quick access to page 1[/-] [+]feature: quick access to page 1[/+] on Sep 7, 2025
  4. izouxv commented on Sep 7, 2025

    @izouxv
    Author

    this is very usefull,This user case is that the client can use the pdfcpu interface to directly obtain the cover page of a PDF through the URL address of the PDF, without the server pre-generate the PDF cover page. It can obtain the cover page with minimal traffic using just the URL address.

    	if conf.FastCover {
    		coverShrinkTable(c, ctx)
    	}
    

    Fast cover only keeps page 1, and does not intrude on other pages, so this feature is safe.

  5. hhrutter commented on Sep 8, 2025

    @hhrutter
    Collaborator

    I don't doubt that - still a radical code change.
    Let me think about that.
    I keep it in the pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions