Print Page | Close Window

RenderDocumentToFile with transparent images

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3773
Printed Date: 26 Apr 24 at 7:20AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: RenderDocumentToFile with transparent images
Posted By: bbenc
Subject: RenderDocumentToFile with transparent images
Date 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



Replies:
Posted By: Ingo
Date 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.




-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk