Print Page | Close Window

3D-PDF from Solid Edge + AddImageFromFile

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=3534
Printed Date: 22 Nov 24 at 2:11PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: 3D-PDF from Solid Edge + AddImageFromFile
Posted By: m_kiess
Subject: 3D-PDF from Solid Edge + AddImageFromFile
Date Posted: 21 Dec 17 at 8:40AM
Hello,
 
i have a problem with 3D-PDFs.
 
From Solid Edge i save an assembly as 3D-PDF.
 
now i want to add a image to the PDF.
 
Here is my code in Visual Studio 2015 VB:
 

Try

QP = CreateObject(ClassName)

Catch ex As Exception

Finally

If QP.UnlockKey(LicenseKey) = 0 Then
                                MsgBox("Debenu PDF Library - Invalid license key: Have you included your license key? -")
                                QP = Nothing
                            Else
                                QP.LoadFromFile(strtempFilename, "")
 

                                  ' Prototyp einfügen
                                    Dim strPrototypDateiname = DrFritsch_Code1.Reg_lesen_PDF_Prototyp_Dateiname()
                                    If strPrototypDateiname = "" Then
                                        MsgBox("Der Text für Prototyp konnte nicht gefunden werden!" & vbNewLine & vbNewLine & "Fehler: Dateiname nicht definiert", MsgBoxStyle.Information, "Automatische PDF Erstellung")
                                    ElseIf Not My.Computer.FileSystem.FileExists(strPrototypDateiname) Then
                                        MsgBox("Die Datei für die Kennzeichnung von Prototypen der PDFs konnte nicht gefunden werden!" & vbNewLine & vbNewLine & "Fehler: Dateiname nicht gefunden: " & strPrototypDateiname, MsgBoxStyle.Information, "Automatische PDF Erstellung")
                                    Else
                                        Dim dblPrototyp_Position_Links As Double = DrFritsch_Code1.Reg_lesen_PDF_Prototyp_Werte(1)
                                        Dim dblPrototyp_Position_Oben As Double = DrFritsch_Code1.Reg_lesen_PDF_Prototyp_Werte(2)
                                        Dim dblPrototyp_Position_Breit As Double = DrFritsch_Code1.Reg_lesen_PDF_Prototyp_Werte(3)
                                        Dim dblPrototyp_Position_Hoehe As Double = DrFritsch_Code1.Reg_lesen_PDF_Prototyp_Werte(4)
                                        Dim intPrototyp_Options As Integer = DrFritsch_Code1.Reg_lesen_PDF_Prototyp_Werte(5)
                                        'If dblPrototyp_Position_Links = 0 Then dblPrototyp_Position_Links = 200
                                        'If dblPrototyp_Position_Oben = 0 Then dblPrototyp_Position_Oben = 200
                                        If dblPrototyp_Position_Breit = 0 Then dblPrototyp_Position_Breit = 500
                                        If dblPrototyp_Position_Hoehe = 0 Then dblPrototyp_Position_Hoehe = 300
                                        ' Call CompressImages prior to AddImageFromFile,
                                        ' if image data Is uncompressed it will be
                                        ' compressed using flate, if already compressed
                                        ' no change will occur
                                        rc = QP.CompressImages(1)
                                        Dim intPageCount = QP.PageCount
                                        rc = QP.AddImageFromFile(strPrototypDateiname, 0)
                                        ' Select the image
                                        rc = QP.SelectImage(rc)

                                        ' Get the horizontal And vertical resolution
                                        ' of the image if it exists
                                        Dim dpix = QP.ImageHorizontalResolution()
                                        Dim dpiy = QP.ImageVerticalResolution()
                                        ' If image does Not have a DPI use 72 as default
                                        If (dpix = 0) Then dpix = 72
                                        If (dpiy = 0) Then dpiy = 72
                                        ' Calculate image width in points
                                        ' taking into account the image size in
                                        ' pixels And the DPI value
                                        Dim ImageWidthInPoints As Double = QP.ImageWidth() / dpix * 72.0        ' assumming dpi units
                                        Dim ImageHeightInPoints As Double = QP.ImageHeight() / dpiy * 72.0
                                        QP.SetOrigin(1)     ' Top Left
                                        ' Start drawing the top left corner of the image
                                        rc = QP.DrawImage(dblPrototyp_Position_Links, dblPrototyp_Position_Oben, ImageWidthInPoints, ImageHeightInPoints)


                                    End If
                                End If
                                QP.SaveToFile(strtempFilename)

                                QP = Nothing
                            End If
                        End Try
 
 
but in the 3D-PDF the image is not visible.
 
Has anyone a solution
 
Greatings from Fellbach
 
Martin



Replies:
Posted By: Ingo
Date Posted: 21 Dec 17 at 10:15PM
Hi Martin,

one reason can be the rotate option of the pdf while opening.
Another reason can be problems with contentstreams (layers).
Tese issues can lead to image positions out of the normal visible dimensions.
So you can try a CombineContentStreams:
http://www.debenu.com/docs/pdf_library_reference/CombineContentStreams.php
...followed by a NormalizePage:
http://www.debenu.com/docs/pdf_library_reference/NormalizePage.php
...and then try to position the new image.

Cheers and welcome here,
Ingo

Merry Christmas and a good start into a fantastic 2018 to you and all users here :)




-------------
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