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!
3D-PDF from Solid Edge + AddImageFromFile |
Post Reply |
Author | |
m_kiess
Beginner Joined: 21 Dec 17 Location: Fellbach Status: Offline Points: 2 |
Post Options
Thanks(0)
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
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
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