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 - RenderDocumentToFile with transparent images
  FAQ FAQ  Forum Search   Register Register  Login Login

RenderDocumentToFile with transparent images

 Post Reply Post Reply
bbenc View Drop Down

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: RenderDocumentToFile with transparent images
    Posted: 06 Jan 20 at 6:01AM
I originally posted same topic but it hasn't been resolved and my trial expires soon and I need to know if this product will meet my needs (hence the new post):

I am trying to add a watermark (transparent image) to a image file. Below is some basic code to show that you can create a pdf with watermarks but using the same code it does not produce the same results when creating an image file (.SaveToFile vs .RenderDocumentToFile). The image file (.RenderDocumentToFile) only shows the overlaid image with 0 transparency.

Can anyone please help me create an image file with transparent images?

    strImportFolder = "E:\FOXIT\Testing"
    strImportFile = "IMG_3560"
    strImportFileExt = "jpg"
    strWMFolder = "E:\FOXIT\Testing"
    strWMFile = "TestWM"
    strWMFileExt = "jpg"
    strExportFolder = "E:\FOXIT\Testing\"
    strExportFile = "Image_3560"
    strExportFileExt = "jpg"
    dblPage = 1
    dblTransparency = 90
    Set objPDF = CreateObject(gcstrPDFLibrary)
    If objPDF.UnlockKey(gcstrPDFLicense) = 1 Then
        Call objPDF.AddImageFromFile(strImportFolder & "\" & strImportFile & "." & strImportFileExt, 0)
        dblWidth = objPDF.ImageWidth()
        dblHeight = objPDF.ImageHeight()
        ret = objPDF.SetPageDimensions(dblWidth, dblHeight)
        ret = objPDF.DrawImage(0, dblHeight, dblWidth, dblHeight)
        ret = objPDF.SelectPage(dblPage)
        ret = objPDF.NormalizePage(0)
        ret = objPDF.SetOrigin(1)
        dblContentStream = objPDF.NewContentStream
        ret = objPDF.SelectContentStream(dblContentStream)
        ret = objPDF.SaveState
        dblWMImageID = objPDF.AddImageFromFile(strWMFolder & "\" & strWMFile & "." & strWMFileExt, 0)
        ret = objPDF.SelectImage(dblWMImageID)
        ret = objPDF.SetTransparency(dblTransparency)
        ret = objPDF.DrawImage(0, 0, objPDF.PageWidth, objPDF.PageHeight)
        ret = objPDF.LoadState
        ret = objPDF.MoveContentStream(dblContentStream, objPDF.ContentStreamCount)
        Call objPDF.CombineContentStreams
        ret = objPDF.SaveToFile(strExportFolder & "\" & strExportFile & ".pdf")
        ret = objPDF.RenderDocumentToFile(300, 1, 1, 1, strExportFolder & "\" & strExportFile & "." & strExportFileExt)
    End If
    Set objPDF = Nothing

Edited by bbenc - 06 Jan 20 at 6:11AM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group

Joined: 29 Oct 05
Status: Offline
Points: 3172
Post Options Post Options   Thanks (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jan 20 at 8:36AM
QuickPDF embeds several image-/render libraries for rendering.
These libraries themself are offering a lot of more functionalities - your transparency-options as well.
QuickPDF is for pdf - Render libraries are more for images ;-)
The described special needs you won't feed with the actual version of QuickPDF.
For this issue you should dive deeper into the libraries like Cairo, PDFium, GDI+ or AGG.


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