Closed zgordan-vv closed 2 years ago
I am trying to render an image from the PDF document.
The image should look like the PDF document.
The image looks like a very pixelized/blurred version of the PDF document. Steps to reproduce the behavior:
chart.pdf chart.png
package main import ( "os" "github.com/unidoc/unipdf/v3/model" "github.com/unidoc/unipdf/v3/render" ) func main() { f, err := os.Open("chart.pdf") if err != nil { panic(err) } defer f.Close() reader, err := model.NewPdfReaderLazy(f) if err != nil { panic(err) } chartPage, err := reader.GetPage(1) if err != nil { panic(err) } if err = render.NewImageDevice().RenderToPath(chartPage, "chart.png"); err != nil { panic(err) } }
Basically just need to set the returned (from render.NewImageDevice()) device.OutputWidth = width to the desired pixel output width.
device.OutputWidth = width
Description
I am trying to render an image from the PDF document.
Expected Behavior
The image should look like the PDF document.
Actual Behavior
The image looks like a very pixelized/blurred version of the PDF document. Steps to reproduce the behavior:
Attachments
chart.pdf chart.png