Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Create image file but retain pdf transparency
  FAQ FAQ  Forum Search   Register Register  Login Login

Create image file but retain pdf transparency

 Post Reply Post Reply
Author
Message
bbenc View Drop Down
Beginner
Beginner


Joined: 20 Dec 19
Location: Australia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote bbenc Quote  Post ReplyReply Direct Link To This Post Topic: Create image file but retain pdf transparency
    Posted: 20 Dec 19 at 6:40AM
Hello, I have just found this amazing sdk but I am having some difficulties with creating image files from PDF.
I can create a pdf and load an image to it with transparency (basic outline of code below)  
Call objPDF.LoadFromFile(strPDFFolder & "\" & strPDFFile, "")
dblImageID = objPDF.AddImageFromFile(strWMFolder & "\" & strWMFile, 0)
objPDF.NormalizePage (0)
objPDF.SetOrigin (1)
dblContentStream = objPDF.NewContentStream
objPDF.SelectContentStream (dblContentStream)
objPDF.SaveState
objPDF.SetTransparency (dblTransparency)
objPDF.SelectImage (dblImageID)
Call objPDF.DrawImage(0, 0, objPDF.PageWidth, objPDF.PageHeight)
objPDF.LoadState
Call objPDF.MoveContentStream(dblContentStream, IIf(blnLayerZero = True, 0, objPDF.ContentStreamCount + 1))
objPDF.SaveToFile (strPDFFolderNew & "\" & strPDFFileNew)

This applies an image to the PDF and sets it transparency perfectly, but when generating the image file the actual image I applied to the PDF is the only thing I see in the image file, so the transparency setting I applied is being ignored and set at 100 (assuming). 

Is there any way to create the image file that retains the transparency we apply to the PDF?

Thanks,

Benjamin
Back to Top
bbenc View Drop Down
Beginner
Beginner


Joined: 20 Dec 19
Location: Australia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote bbenc Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 19 at 6:43AM
oh, sorry, forgot to add. I am using the following code to generate the image file:
Call objPDF.RenderDocumentToFile(dblDPI, 1, dblPages, 0, strPDFFolder & "\" & strImageFile & "." & strImageFileExt)
Ive also tried the DARenderToPage with the same results.
I am using version 17 activeX or DLL.


Edited by bbenc - 20 Dec 19 at 7:44AM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 19 at 11:03AM
Hi Benjamin,

did you do the rendering right after the save?
Try it after a new load...

Cheers and welcome here,
Ingo

Cheers,
Ingo

Back to Top
bbenc View Drop Down
Beginner
Beginner


Joined: 20 Dec 19
Location: Australia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote bbenc Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 19 at 2:40PM
Thankyou for the reply Ingo, but unfortunately that didn't work for me (as that's what I was doing), but thought I might try the render immediately (ie: before the save to pdf) but unfortunately that didn't work either.
My code is written modularly, so the first module combines the images, saves them as a pdf, and releases the object. The next module does a fresh load of the saved file and renders to image.
I was thinking the layers weren't supported by jpg, so I tried gif/tif/png...all 10 supported file formats and still get the same result...The semi transparent image becomes 0% transparent (fully displayed) in the image file.
The test image file I am using (as the transparent layer) has a white background. Maybe I could try and overlay an image without a background layer. I'm really not sure what else to try.
Back to Top
bbenc View Drop Down
Beginner
Beginner


Joined: 20 Dec 19
Location: Australia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote bbenc Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 19 at 2:50PM
Just tried a "background-less" image, but when its put into the pdf, it masks the "missing" background with white. The render to image retains that white background.
Back to Top
bbenc View Drop Down
Beginner
Beginner


Joined: 20 Dec 19
Location: Australia
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote bbenc Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 19 at 3:00PM
Ok, so I just tried to apply transparent text to a pdf and then render it to an image and it worked perfectly, so not sure why the transparent image is not co-operating.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store