I need to insert an XML file inside a PDF (as attachment) using Access VBA and I would like to find a solution without buying Acrobat.
Then I need to sing it digitally PAdES BES and save the file in PDF/A-3.
Is there some ideas or better some code?
Thanks.
You can use our DynamicPDF Core Suite for COM/ActiveX v11 to achieve this. It supports embedding files in a PDF and digitally signing it with PAdES. Here is a VBA sample:
Dim MyDocument As DynamicPDF.Document
Dim MyPage As DynamicPDF.Page
Set MyDocument = New DynamicPDF.Document
MyDocument.LoadPdf ("C:\Input.pdf")
Set MyPage = MyDocument.GetPage(1)
Dim MyXmp As DynamicPDF.XmpMetaData
Set MyXmp = MyDocument.SetXmpMetaData
MyXmp.AddPdfASchema DPDF_PdfAStandard_PDF_A_3a
Dim MyEmbeddedFile
Set MyEmbeddedFile = MyDocument.AddEmbeddedFile("C:\XMLFile.xml", "")
MyEmbeddedFile.Relation = DPDF_EmbeddedFileRelation_Source
MyEmbeddedFile.MimeType = "application/xml"
Dim MySignature As DynamicPDF.Signature
Set MySignature = MyPage.AddSignature("SigField", 10, 10, 250, 100)
MySignature.Visible = True
Dim MyCertificate As DynamicPDF.Certificate
Set MyCertificate = MyDocument.DigitalSignatures.GetCertificate("C:\JohnDoe.pfx", "password")
MyCertificate.SignatureType = DPDF_SignatureType_PAdESBasic
MyDocument.Sign "SigField", MyCertificate
MyDocument.DrawToFile ("C:\Output.pdf")
You can find more information about DynamicPDF Core Suite for COM/ActiveX at the link below:
https://www.dynamicpdf.com/PDF-Suite-COM.aspx
Please note that you will need to use version 11 (currently available as a BETA version) to achieve this:
https://www.dynamicpdf.com/beta.aspx
Related
I'm using Geckofx 60 to fill a web form. I have to attach an image file also. I can select/click Chose file and Select a file manually. Is there any way to select a local file without opening dialog?
Dim el As GeckoHtmlElement = GeckoWebBrowser1.DomDocument.GetElementsByTagName("input").FirstOrDefault(Function(elz) elz.GetAttribute("type") = "file")
Dim fileNames = New IntPtr(0) {}
Dim domInput = Xpcom.QueryInterface(Of nsIDOMHTMLInputElement)(el.DOMHtmlElement)
domInput.MozSetFileNameArray(fileNames, CUInt(fileNames.Length)) 'Getting Error
Marshal.ReleaseComObject(domInput)
Dim ev As DomEventArgs = GeckoWebBrowser1.Document.CreateEvent("HTMLEvents")
Dim webEvent = New [Event](GeckoWebBrowser1.Window.DomWindow, TryCast(ev.DomEvent, nsISupports))
webEvent.InitEvent("change", True, True)
el.GetEventTarget().DispatchEvent(ev)
CustomMarshalers.WStringMarshaler().CleanUpNativeData(fileNames)
I have Got the Error above after checking How to choose and upload a local file to a website using Geckofx in C#?
I regularly need to export existing JT models to tesselated JT models which takes a looong time on my computer. So I was wondering if this can be done via a script? Ideally embedded in an Excel file where I provide a list of JT filenames and paths, but one by one would also be okay. As long as I don't have to manually open and export each file in Inventor.
Import options that need to be set:
- Object filter: Solids
Export options:
- Object Types to export: all ticked
- Output: Facets only
- Version: 9.5
- Structure: Monolithic
Can this be done? I have some VBA experience, however absolutely no experience specifically with Inventor as far as scripting/command line stuff goes ....
Thanks!
dreamingof8a
I don't have at the moment the solution for the Options. But this is the script to export to JT.
It's based on the STEP example in the Inventor API documentation.
Public Sub ExportToJT(inventorFile As String, jtFile As String)
' Get the JT translator Add-In.
Dim oJTTranslator As TranslatorAddIn
Set oJTTranslator = ThisApplication.ApplicationAddIns.ItemById("{16625A0E-F58C-4488-A969-E7EC4F99CACD}")
If oJTTranslator Is Nothing Then
MsgBox "Could not access JT translator."
Exit Sub
End If
Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
If oJTTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
' Other options...
'oOptions.Value("Author") = ""
'oOptions.Value("Authorization") = ""
'oOptions.Value("Description") = ""
'oOptions.Value("Organization") = ""
oContext.Type = kFileBrowseIOMechanism
Dim oData As DataMedium
Set oData = ThisApplication.TransientObjects.CreateDataMedium
oData.FileName = jtFile
Call oJTTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData)
End If
End Sub
I'm trying to develop a program which allows the user to convert a pdf file to a word file using vb.net.
Is there any good API for this ?
And, is it as easy as it looks like?
try this,
' Path of input PDF document
Dim filePath As String = "d:\\Source.pdf"
' Instantiate the Document object
Dim document As Aspose.Pdf.Document = New Aspose.Pdf.Document(filePath)
' Create DocSaveOptions object
Dim saveOptions As DocSaveOptions = New DocSaveOptions()
' Set the recognition mode as Flow
saveOptions.Mode = DocSaveOptions.RecognitionMode.Flow
' Set the Horizontal proximity as 2.5
saveOptions.RelativeHorizontalProximity = 2.5F
' Enable the value to recognize bullets during conversion process
saveOptions.RecognizeBullets = True
' save the resultnat DOC file
document.Save("d:\\Resultant.doc", saveOptions)
I have a existing PDF file and with iTextSharp I want to test if it is PDF/A compliant.
I don't want convert or create a file, just read and check if it is a PDF/A.
I have not tried anything because I did not find any methods or properties of the class PdfReader of iTextSharp, saying that the PDF is PDF/A. For now it would be enough to know how to verify that the document claims to be PDF/A compatible
Thanks
Antonio
After a long search i tried this way and seems to work:
Dim reader As iTextSharp.text.pdf.PdfReader = New iTextSharp.text.pdf.PdfReader(sFilePdf)
Dim yMetadata As Byte() = reader.Metadata()
Dim bPDFA As Boolean = False
If Not yMetadata Is Nothing Then
Dim sXmlMetadata = System.Text.ASCIIEncoding.Default.GetString(yMetadata)
Dim xmlDoc As Xml.XmlDocument = New Xml.XmlDocument()
xmlDoc.LoadXml(sXmlMetadata)
Dim nodes As Xml.XmlNodeList = xmlDoc.GetElementsByTagName("pdfaid:conformance")
If nodes.Item(0).FirstChild.Value.ToUpper = "A" Then
bPDFA = True
End If
End If
Return bPDFA
I also found some reference to the class XmpReader, but not sufficient to do what I wanted
Its 5th Question and apart of one I didn't get response from the experts....
Hope this time I will get the helping hand.
I want to do mailmerge in openoffice using Vb.net and I am totally new with openoffice.
I searched on net for some help to understand how to use openoffice with vb.net but all I get is half info.....So can you please help me and give me code for mailmerge in vb.net for openoffice.
Well i have list of workers in DB and there is this facility that if they want to mail to all or some of the workers then they can do it.I have completed this task using Microsoft Office now as a Add in we are providing the facility to perform the same task using Open Office.
What they have to do is just select the List of workers and click on a button and it will automate the mailmerge using the field of those workers data from DB. The Code of mine is as shown below
Public Sub OpenOfficeMail(ByVal StrFilter As String)
Dim oSM ''Root object for accessing OpenOffice from VB
Dim oDesk, oDoc As Object ''First objects from the API
Dim arg(-1) ''Ignore it for the moment !
''Instanciate OOo : this line is mandatory with VB for OOo API
oSM = CreateObject("com.sun.star.ServiceManager")
''Create the first and most important service
oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
''Create a new doc
oDoc = oDesk.loadComponentFromURL("private:factory/swriter", "_blank", 0, arg)
''Close the doc
oDoc.Close(True)
oDoc = Nothing
''Open an existing doc (pay attention to the syntax for first argument)
oDoc = oDesk.loadComponentFromURL("file:///C:\Users\Savan\Documents\1.odt", "_blank", 0, arg)
Dim t_OOo As Type
t_OOo = Type.GetTypeFromProgID("com.sun.star.ServiceManager")
Dim objServiceManager As New Object
objServiceManager = System.Activator.CreateInstance(t_OOo)
Dim oMailMerge As New Object
oMailMerge = t_OOo.InvokeMember("createInstance", Reflection.BindingFlags.InvokeMethod, Nothing, _
objServiceManager, New [Object]() {"com.sun.star.text.MailMerge"}) 'com.sun.star.text.MailMerge"})
oMailMerge.DocumentURL = "file:///C:\Users\Savan\Documents\1.odt"
oMailMerge.DataSourceName = CreateSource(StrFilter)''Function that will return the datasource name which will be a text file's path
oMailMerge.CommandType = 0
oMailMerge.Command = "file:///C:\Mail.txt"
oMailMerge.OutputType = 2
oMailMerge.execute(New [Object]() {})**---->I am getting Error here**
End Sub