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!
Create image file but retain pdf transparency |
Post Reply |
Author | |
bbenc
Beginner Joined: 20 Dec 19 Location: Australia Status: Offline Points: 8 |
Post Options
Thanks(0)
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
|
|
bbenc
Beginner Joined: 20 Dec 19 Location: Australia Status: Offline Points: 8 |
Post Options
Thanks(0)
|
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Benjamin, did you do the rendering right after the save? Try it after a new load... Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
bbenc
Beginner Joined: 20 Dec 19 Location: Australia Status: Offline Points: 8 |
Post Options
Thanks(0)
|
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.
|
|
bbenc
Beginner Joined: 20 Dec 19 Location: Australia Status: Offline Points: 8 |
Post Options
Thanks(0)
|
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.
|
|
bbenc
Beginner Joined: 20 Dec 19 Location: Australia Status: Offline Points: 8 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store