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

Resize using API not as expect #799

Closed
mmmcatoo opened this issue Feb 7, 2024 · 3 comments
Closed

Resize using API not as expect #799

mmmcatoo opened this issue Feb 7, 2024 · 3 comments
Assignees

Comments

@mmmcatoo
Copy link

mmmcatoo commented Feb 7, 2024

I have a PDF file with a page size of 100150 millimeters, and I would like to resize the page size of the PDF using api. So that it can be printed on a paper size of 100200 millimeters using a label printer.

Which my code like below:

resultFileName := fmt.Sprintf("%s/%s.pdf", resultWd, value)
// Modify as 100*200mm
if err := api.ResizeFile(p, resultFileName, []string{}, &model.Resize{
    Scale: 1,
    Unit:  types.CENTIMETRES,
    PageDim: &types.Dim{
        Width:  10.0,
        Height: 20.0,
    },
    UserDim:       true,
    EnforceOrient: true,
}, nil); err != nil {
    log.Fatalln(err)
}

But the result PDF still in 100*150 millimeters. In my go.sum the version show is : require github.com/pdfcpu/pdfcpu v0.6.0

@hhrutter
Copy link
Collaborator

hhrutter commented Feb 8, 2024

Hello!

Did you try this using the CLI?

@hhrutter
Copy link
Collaborator

hhrutter commented Feb 10, 2024

The resize command is resizing the page only, the content's proportions will be preserved and fitted into the resized page.
If you are still having problems, please share a sample file.

Thank you for using pdfcpu 💚

@hhrutter
Copy link
Collaborator

Closed due to inactivity.

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

2 participants