You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using device.Render to convert a page of a pdf to an image does so without transparency.
Expected Behavior
When the input PDF has transparency, the image rendered should have the same transparency.
Actual Behavior
Running the following PDF (or any PDF with transparency) through the device.Render gives me an image that does not respect the transparency of the original PDF.
Attachments
Here is my code for an example:
func pdfToImage(file io.ReadSeeker) error {
// create a new reader
pdfReader, err := pdf.NewPdfReader(file)
if err != nil {
return err
}
// get total number of pages
numPages, err := pdfReader.GetNumPages()
if err != nil {
return err
}
// for each page
for i := 1; i <= numPages; i++ {
// get specific page by number
page, err := pdfReader.GetPage(i)
if err != nil {
return err
}
// create device to render page onto
device := render.NewImageDevice()
// render image to path
err = device.RenderToPath(page, "some/path.png")
if err != nil {
return err
}
}
return nil
}
Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/
Description
Using
device.Render
to convert a page of a pdf to an image does so without transparency.Expected Behavior
When the input PDF has transparency, the image rendered should have the same transparency.
Actual Behavior
Running the following PDF (or any PDF with transparency) through the device.Render gives me an image that does not respect the transparency of the original PDF.
Attachments
Here is my code for an example:
Original PDF:
transparent_watermark.pdf
Output image:
The text was updated successfully, but these errors were encountered: