Byte array to pdf
Author: l | 2025-04-23
Byte Array to PDF Convert PDF File to Byte Array or Byte Array to PDF using C Byte Array is helpful for storing or transmitting data. Likewise, the PDF file format is popular
Converting image byte array to pdf byte array - PDFsharp
Com.adobe.idp.Document object’s copyToFile method to extract the PDF document. See also Programmatically Disassembling PDF Documents Quick Start (SOAP mode): Disassembling a PDF document using the Java API Including AEM Forms Java library files Setting connection properties Disassemble a PDF document using the web service API disassemble-a-pdf-document-using-the-web-service-api Disassemble a PDF document by using the Assembler Service API (web service): Include project files. Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition when setting a service reference: note note NOTE Replace localhost with the IP address of the server hosting AEM Forms. Create a PDF Assembler client. Create an AssemblerServiceClient object by using its default constructor. Create an AssemblerServiceClient.Endpoint.Address object by using the System.ServiceModel.EndpointAddress constructor. Pass a string value that specifies the WSDL to the AEM Forms service (for example, You do not need to use the lc_version attribute. This attribute is used when you create a service reference. Create a System.ServiceModel.BasicHttpBinding object by getting the value of the AssemblerServiceClient.Endpoint.Binding field. Cast the return value to BasicHttpBinding. Set the System.ServiceModel.BasicHttpBinding object’s MessageEncoding field to WSMessageEncoding.Mtom. This value ensures that MTOM is used. Enable basic HTTP authentication by performing the following tasks: Assign the AEM forms user name to the field AssemblerServiceClient.ClientCredentials.UserName.UserName. Assign the corresponding password value to the field AssemblerServiceClient.ClientCredentials.UserName.Password. Assign the constant value HttpClientCredentialType.Basic to the field BasicHttpBindingSecurity.Transport.ClientCredentialType. Assign the constant value BasicHttpSecurityMode.TransportCredentialOnly to the field BasicHttpBindingSecurity.Security.Mode. Reference an existing DDX document. Create a BLOB object by using its constructor. The BLOB object is used to store the DDX document. Create a System.IO.FileStream object by invoking its constructor. Pass a string value that represents the file location of the DDX document and the mode in which to open the file. Create a byte array that stores the content of the System.IO.FileStream object. You can determine the size of the byte array by getting the System.IO.FileStream object’s Length property. Populate the byte array with stream data by invoking the System.IO.FileStream object’s Read method and passing the byte array, the starting position, and the stream length to read. Populate the BLOB object by assigning its MTOM property with the contents of the byte array. Reference a PDF document to disassemble. Create a BLOB object by using its constructor. The BLOB object is used to store the input PDF document. This BLOB object is passed to the invokeOneDocument as an argument. Create a System.IO.FileStream object by invoking its constructor and passing a string value that represents the file location of the input PDF document and the mode in which to open the file. Create a byte array that stores the content of the System.IO.FileStream object. You can determine the size of the byte array by getting the System.IO.FileStream object’s Length property. Populate the byte array with stream data by invoking the System.IO.FileStream object’s Read method and passing the byte array, the starting position, and the stream length to read. Populate the BLOB object by assigning its MTOM field the contents of the byte array. Create a MyMapOf_xsd_string_To_xsd_anyType
Convert PDF File to Byte Array or Byte Array to PDF using C
Namespace:ceTe.DynamicPDF.ConversionAssemblies:DynamicPDF.Converter.dllOverloadsConvert()Converts Image to PdfConvert(Byte[])Converts Image to PdfConvert(String)Converts Image to PdfConvert()Converts Image to Pdfpublic Byte[] Convert()Function Convert() As Byte()ReturnsByte[]returns a output pdf byte arrayLicensing InfoThis method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:An active DynamicPDF SubscriptionAn active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.A DynamicPDF Converter for .NET v3.X Developer license.ExamplesThis example shows how to use convert method with output byte array as return type.Imports ceTe.DynamicPDF.ConversionModule Module1Sub Main() ' Create new instance of Converter by providing suitable parameters. Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg") ' Call Convert method to start conversion Dim output As Byte() = imageConversion.Convert() If (output IsNot Nothing) Then 'save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf", output) End IfEnd Sub End Moduleusing ceTe.DynamicPDF.Conversion;class MyClass{ static void Main() { // Create new instance of Converter. ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg"); //Call Convert method to start conversion byte []output=image.Convert(); if(output!=null) { //save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf",output); } }}Convert(Byte[])Converts Image to Pdfpublic Byte[] Convert(Byte[] pdfToAppendTo)Function Convert(pdfToAppendTo As Byte()) As Byte()ParameterspdfToAppendToByte[]Contents of Pdf in byte array format, to which the current conversion needs to be appended toReturnsByte[]returns a Task where the result type is byte arrayLicensing InfoThis method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:An active DynamicPDF SubscriptionAn active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.A DynamicPDF Converter for .NET v3.X Developer license.ExamplesThis example shows how to use convert method with appendToPdf as parameter and output byte array as return type.Imports ceTe.DynamicPDF.ConversionModule Module1Sub Main() ' Create new instance of Converter by providing suitable parameters. Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg") ' Call Convert method to start conversion Dim output As Byte() = imageConversion.Convert() If (output IsNot Nothing) Then Dim finalOutput As Byte() = imageConversion.Convert(output) 'save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf", finalOutput) End IfEnd Sub End Moduleusing ceTe.DynamicPDF.Conversion;class MyClass{ static void Main() { // Create new instance of Converter. ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg"); //Call Convert method to start conversion byte []output=image.Convert(); if(output!=null) { byte []finalOutputByte=image.Convert(output); //save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf",finalOutputByte); }Converting Excel file in byte array to PDF file in byte array
Using System;using System.Text;using UdonSharp;using UnityEngine;using VRC.SDK3.Data;public class BitConverterExample : UdonSharpBehaviour{ void Start() { //Create test data int originalInt = 63; double originalDouble = 734531.433d; string originalString = "Test string"; float[] originalFloatArray = new float[] { 543, 12.6f, 63.1231f }; //Serialize and then deserialize byte[] serialized = Serialize(originalInt, originalDouble, originalString, originalFloatArray); Deserialize(serialized, out int newInt, out double newDouble, out string newString, out float[] newFloatArray); //Print the results to see if everything matches Debug.Log($"{originalInt} - {newInt}"); Debug.Log($"{originalDouble} - {newDouble}"); Debug.Log($"{originalString} - {newString}"); Debug.Log($"{originalFloatArray.Length} - {newFloatArray.Length}"); for (int i = 0; i originalFloatArray.Length && i newFloatArray.Length; i++) { Debug.Log($"{originalFloatArray[i]} - {newFloatArray[i]}"); } //For individual values we can also use DataToken Bitcasting to get bit access double doubleValue = 123.456d; DataToken doubleToken = new DataToken(doubleValue); //We used ulong because it has the same size as a double (8 bytes) DataToken ulongToken = doubleToken.Bitcast(TokenType.ULong); DataToken resultDoubleToken = ulongToken.Bitcast(TokenType.Double); Debug.Log($"{doubleToken} - 0x{ulongToken:02X} - {resultDoubleToken}"); } /// /// An example function which serializes a pre-determined set of data into a byte array /// /// Integer which will be encoded into the output /// Double which will be encoded into the output /// String which will be encoded into the output /// Float array which will be encoded into the output /// byte[] Serialize(int intValue, double doubleValue, string stringValue, float[] floatArrayValues) { int size = 0; byte[] intBytes = BitConverter.GetBytes(intValue); //Convert int to bytes size += intBytes.Length; byte[] doubleBytes = BitConverter.GetBytes(doubleValue); //Convert int to bytes size += doubleBytes.Length; byte[] stringBytes = Encoding.UTF8.GetBytes(stringValue); //Convert string to bytes size += stringBytes.Length; Debug.Log($"String byte length {stringBytes.Length}"); byte[] stringLengthBytes = BitConverter.GetBytes(stringBytes.Length); //Convert string length to bytes size += stringLengthBytes.Length; byte[] floatArrayLengthBytes = BitConverter.GetBytes(Buffer.ByteLength(floatArrayValues)); size += floatArrayLengthBytes.Length; //It is not necessary to convert the float array into a byte array because we can BlockCopy it directly size += Buffer.ByteLength(floatArrayValues); byte[] output = new byte[size]; //Allocate an array of the correct size that should fit all of our items int offset = 0; Buffer.BlockCopy(intBytes, 0, output, offset, intBytes.Length); //Write int - this should take up 4 bytes offset += intBytes.Length; //Increment offset so the next item can write to the correct location Buffer.BlockCopy(doubleBytes, 0, output, offset, doubleBytes.Length); //Write double - this should take up 8 bytes offset += doubleBytes.Length; Buffer.BlockCopy(stringLengthBytes, 0, output, offset, stringLengthBytes.Length); //Write the length of the string so the decoder knows how much to decode - this should take up 4 bytes offset += stringLengthBytes.Length; Buffer.BlockCopy(stringBytes, 0, output, offset, stringBytes.Length); //Write string - this is variable, which is why we need to encode the length of the string above offset += stringBytes.Length; Buffer.BlockCopy(floatArrayLengthBytes, 0, output, offset, floatArrayLengthBytes.Length); //Write the length of the float array so the decoder knows how much to decode - this should take up 4 bytes offset += floatArrayLengthBytes.Length; Buffer.BlockCopy(floatArrayValues, 0, output, offset, Buffer.ByteLength(floatArrayValues)); //Write float array - this can be done directly without a byte array conversion because it's already an Array offset += Buffer.ByteLength(floatArrayValues); Debug.Log($"Encoded data in {output.Length} bytes"); return output; } /// /// An example function which deserializes a pre-determined set of data described in. Byte Array to PDF Convert PDF File to Byte Array or Byte Array to PDF using C Byte Array is helpful for storing or transmitting data. Likewise, the PDF file format is popular Converts the source byte array to PDF. Convert(Byte[], String, ConversionOptions, Byte[]) Converts the source byte array to PDF and get the output as byte array. Convert(Byte[], StringHow to convert byte array of word doc into byte array of pdf
Uint size) { int read_size = 0; file_.Seek(offset, SeekOrigin.Begin); byte[] array = new byte[size + 1]; read_size = file_.Read(array, 0, (int)size); Marshal.Copy(array, 0, buffer, (int)size); return read_size == size ? true : false; } public override void Release() { this.file_.Close(); } }...FileReader file_reader = new FileReader(offset);file_reader.LoadFile(file_name);PDFDoc doc_real = new PDFDoc(file_reader, false)error_code = doc.Load(null);if (error_code != ErrorCode.e_ErrSuccess) return;...How to load PDF document and get the first page of the PDF documentusing foxit.pdf;using foxit.common;...PDFDoc doc = new PDFDoc("Sample.pdf");error_code = doc.Load(null);if (error_code != ErrorCode.e_ErrSuccess) return;...// Get the first page of the document.PDFPage page = doc.GetPage(0);// Parse page.page.StartParse((int)foxit.pdf.PDFPage.ParseFlags.e_ParsePageNormal, null, false);...How to save a PDF to a fileusing foxit.pdf;using foxit.common;...PDFDoc doc = new PDFDoc("Sample.pdf");error_code = doc.Load(null);if (error_code != ErrorCode.e_ErrSuccess) return;...// Do operations for the PDF document....// Save the changes for the PDF document.string newPdf = "the output path for the saved PDF";doc.SaveAs(newPdf, (int)PDFDoc.SaveFlags.e_SaveFlagNoOriginal);How to save a document into memory buffer by FileWriterCallbackusing foxit.pdf;using foxit.common;using foxit.common.fxcrt;using System.IO;using System.Runtime.InteropServices;...class FileWriter : FileWriterCallback{ private MemoryStream memoryfilestream = new MemoryStream(); public FileWriter() { } public override long GetSize() { return this.memoryfilestream.Length; } public override bool WriteBlock(IntPtr pData, long offset, uint size) { byte[] ys = new byte[size]; Marshal.Copy(pData, ys, 0, (int)size); memoryfilestream.Write(ys, 0, (int)size); return true; } public override bool Flush() { return true; } public override void Release() { }}...FileWriter fileWriter = new FileWriter();// Assuming PDFDoc doc has been loaded....doc.StartSaveAs(fileWriter, (int) PDFDoc.SaveFlags.e_SaveFlagNoOriginal,null);...PagePDF Page is the basic and important component of PDF Document. A PDFPage object is retrieved from a PDF document by function PDFDoc.GetPage. Page level APIs providefile upload - Convert doc byte array to pdf byte array in angular
PdfMachine SDK - API for ZUGFeRD / Factur-x invoice generation ZUGFeRD 1.0 ZUGFeRD 2.1.1 / Factur-x 1.0 SOAP Web Service ZUGFeRD 1.0 The pdfMachine SDK can be used to attach xml files to PDFA/3b PDF files to form valid ZUGFeRD 1.0 invoices. The input xml and PDF files must conform to the ZUGFeRD 1.0 documentation. When the fileName parameter of the attachFile method is "zugferd-invoice.xml" then the ZUGFeRD 1.0 metadata will also be inserted into the PDF. The wsdl file for the SOAP Web service installs with the SDK. Method : attachFile Attach an xml to a PDF to form a ZUGFeRD 1.0 compliant PDF. Parameters : inPDF Array of base64 Binary encoded bytes.The PDFA/3b PDF component of the invoice. fileData Array of base64 Binary encoded bytes.he xml representation of the invoice. fileName stringThe name that will be used for the embedded xml. Must be "zugferd-invoice.xml" fileDescription stringThe PDFA/3b PDF component of the invoice. ZUGFeRDtype stringThe corresponding ZUGFeRD 1.0 conformance level consistent with the xml file passed in.BASIC, COMFORT or EXTENDED Parameters : Result Object consisting of outPDF Array of base64 Binary encoded bytes.The resulting PDF. errorMessage stringError Message. ZUGFeRD 1.0 Example C# Parameters : Input PDF path and filename, Input xml attachment path and filename, output PDF path and filename. Optional : url for EndPoint address. using System;using System.Text;using System.IO;using System.ServiceModel;namespace CSharpSoapClientTest{ class Program { static void Main(string[] args) { try { string inPDF = args[0]; string inXML = args[1]; string fileName = "ZUGFeRD-invoice.xml"; string fileDescription = """; string ZUGFeRDtype = "BASIC"; string outputPDF = args[2]; string url = ""; if (args.Length > 3) url = args[3]; ServiceReference1.pdfServMachinePortTypeClient pdfM; pdfM = new CSharpSoapClientTest.ServiceReference1.pdfServMachinePortTypeClient(); if (url.Length > 0) pdfM.Endpoint.Address = new EndpointAddress(url); byte[] pdf = File.ReadAllBytes(inPDF); byte[] xml = File.ReadAllBytes(inXML); string errorMessage; byte[] outPDF = pdfM.attachFile(pdf, xml, fileName, fileDescription, ZUGFeRDtype, out errorMessage); if (errorMessage.Length > 0) System.Console.WriteLine("Error testing attachFile : " + errorMessage); System.IO.File.WriteAllBytes(outputPDF, outPDF); } catch (System.Exception ex) { System.Console.WriteLine(ex); } } }} ZUGFeRD 2.1.1 / Factur-x 1.0 The pdfMachine SDK can be used to attach xml files to PDFA/3b PDF files to form valid ZUGFeRD 2.1.1 / Factur-x 1.0 invoices. The input xml and PDF files must conform to the rules for the ZUGFeRD 2.1.1 / Factur-x 1.0 documentation. Attachments and Explanatory Documents for Invoices can also be attached consistent. The wsdl file for the SOAP Web service installs with the SDK. The API consists of : Exceptions should be caught to trap errors. Method : attachZugferdInvoice Attach an xml to a PDF to form a ZUGFeRD 2.1.1 / Factur-x 1.0 compliant PDF. Parameters : inPDF Array of base64 Binary encoded bytes.The PDFA/3b PDF component of the invoice. inXML Array of base64 Binary encoded bytes.The xml representation ofConvert rtf byte array to pdf byte array in C - Stack Overflow
Pixels.int unitWidth = 2;// Unit height for barcode in pixels, preferred value is >= 20 pixels.int unitHeight = 120;Barcode barcode = new Barcode();Bitmap bitmap = barcode.generateBitmap(codeStr, codeFormat, unitWidth, unitHeight, qrLevel);...SecurityFoxit PDF SDK provides a range of encryption and decryption functions to meet different level of document security protection. Users can use regular password encryption and certificate-driven encryption, or using their own security handler for custom security implementation. It also provides APIs to integrate with the third-party security mechanism (Microsoft RMS). These APIs allow developers to work with the Microsoft RMS SDK to both encrypt (protect) and decrypt (unprotect) PDF documents.Note: For more detailed information about the RMS encryption and decryption, please refer to the simple demo “security” in the “\examples\simple_demo” folder of the download package.Example:How to encrypt a PDF file with Certificateimport com.foxit.sdk.pdf.CertificateEncryptData;import com.foxit.sdk.pdf.CertificateSecurityCallback;import com.foxit.sdk.pdf.CertificateSecurityHandler;import java.io.File;import java.io.UnsupportedEncodingException;import java.security.MessageDigest;import java.util.ArrayList;import java.util.Random;import java.io.ByteArrayOutputStream;import java.io.FileInputStream;import java.util.Enumeration;import java.security.Key;import java.security.KeyStore;import java.security.cert.CertificateFactory;import javax.crypto.Cipher;...// Assuming PDFDoc doc has been loaded....public static Key getPublicKey(String cerPath) { try { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); FileInputStream stream = new FileInputStream(cerPath); java.security.cert.Certificate certificate = certificateFactory.generateCertificate(stream); stream.close(); return certificate.getPublicKey(); } catch (Exception e) { e.printStackTrace(); } return null;}private static byte[] cryptByKey(byte[] inputData, Key key, int opmode) { if (inputData == null) return null; // The max length of decrypted byte array: 128 final int max_crypt_block = 128; try { Cipher cipher = Cipher.getInstance(key.getAlgorithm()); cipher.init(opmode, key); int len = inputData.length; ByteArrayOutputStream stream = new ByteArrayOutputStream(); int offSet = 0; byte[] data; // Decrypt data segment by segment while (len > offSet) { data = cipher.doFinal(inputData, offSet, (len - offSet > max_crypt_block) ? max_crypt_block : (len - offSet)); stream.write(data, 0, data.length); offSet += max_crypt_block; } byte[] outputData = stream.toByteArray(); stream.close(); return outputData; } catch (Exception e) { e.printStackTrace(); } return null;}public static byte[] encryptByKey(byte[] plainData, Key key) { return cryptByKey(plainData, key, Cipher.ENCRYPT_MODE);}public class CertificateSecurityEvent extends. Byte Array to PDF Convert PDF File to Byte Array or Byte Array to PDF using C Byte Array is helpful for storing or transmitting data. Likewise, the PDF file format is popular Converts the source byte array to PDF. Convert(Byte[], String, ConversionOptions, Byte[]) Converts the source byte array to PDF and get the output as byte array. Convert(Byte[], StringComments
Com.adobe.idp.Document object’s copyToFile method to extract the PDF document. See also Programmatically Disassembling PDF Documents Quick Start (SOAP mode): Disassembling a PDF document using the Java API Including AEM Forms Java library files Setting connection properties Disassemble a PDF document using the web service API disassemble-a-pdf-document-using-the-web-service-api Disassemble a PDF document by using the Assembler Service API (web service): Include project files. Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition when setting a service reference: note note NOTE Replace localhost with the IP address of the server hosting AEM Forms. Create a PDF Assembler client. Create an AssemblerServiceClient object by using its default constructor. Create an AssemblerServiceClient.Endpoint.Address object by using the System.ServiceModel.EndpointAddress constructor. Pass a string value that specifies the WSDL to the AEM Forms service (for example, You do not need to use the lc_version attribute. This attribute is used when you create a service reference. Create a System.ServiceModel.BasicHttpBinding object by getting the value of the AssemblerServiceClient.Endpoint.Binding field. Cast the return value to BasicHttpBinding. Set the System.ServiceModel.BasicHttpBinding object’s MessageEncoding field to WSMessageEncoding.Mtom. This value ensures that MTOM is used. Enable basic HTTP authentication by performing the following tasks: Assign the AEM forms user name to the field AssemblerServiceClient.ClientCredentials.UserName.UserName. Assign the corresponding password value to the field AssemblerServiceClient.ClientCredentials.UserName.Password. Assign the constant value HttpClientCredentialType.Basic to the field BasicHttpBindingSecurity.Transport.ClientCredentialType. Assign the constant value BasicHttpSecurityMode.TransportCredentialOnly to the field BasicHttpBindingSecurity.Security.Mode. Reference an existing DDX document. Create a BLOB object by using its constructor. The BLOB object is used to store the DDX document. Create a System.IO.FileStream object by invoking its constructor. Pass a string value that represents the file location of the DDX document and the mode in which to open the file. Create a byte array that stores the content of the System.IO.FileStream object. You can determine the size of the byte array by getting the System.IO.FileStream object’s Length property. Populate the byte array with stream data by invoking the System.IO.FileStream object’s Read method and passing the byte array, the starting position, and the stream length to read. Populate the BLOB object by assigning its MTOM property with the contents of the byte array. Reference a PDF document to disassemble. Create a BLOB object by using its constructor. The BLOB object is used to store the input PDF document. This BLOB object is passed to the invokeOneDocument as an argument. Create a System.IO.FileStream object by invoking its constructor and passing a string value that represents the file location of the input PDF document and the mode in which to open the file. Create a byte array that stores the content of the System.IO.FileStream object. You can determine the size of the byte array by getting the System.IO.FileStream object’s Length property. Populate the byte array with stream data by invoking the System.IO.FileStream object’s Read method and passing the byte array, the starting position, and the stream length to read. Populate the BLOB object by assigning its MTOM field the contents of the byte array. Create a MyMapOf_xsd_string_To_xsd_anyType
2025-03-26Namespace:ceTe.DynamicPDF.ConversionAssemblies:DynamicPDF.Converter.dllOverloadsConvert()Converts Image to PdfConvert(Byte[])Converts Image to PdfConvert(String)Converts Image to PdfConvert()Converts Image to Pdfpublic Byte[] Convert()Function Convert() As Byte()ReturnsByte[]returns a output pdf byte arrayLicensing InfoThis method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:An active DynamicPDF SubscriptionAn active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.A DynamicPDF Converter for .NET v3.X Developer license.ExamplesThis example shows how to use convert method with output byte array as return type.Imports ceTe.DynamicPDF.ConversionModule Module1Sub Main() ' Create new instance of Converter by providing suitable parameters. Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg") ' Call Convert method to start conversion Dim output As Byte() = imageConversion.Convert() If (output IsNot Nothing) Then 'save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf", output) End IfEnd Sub End Moduleusing ceTe.DynamicPDF.Conversion;class MyClass{ static void Main() { // Create new instance of Converter. ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg"); //Call Convert method to start conversion byte []output=image.Convert(); if(output!=null) { //save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf",output); } }}Convert(Byte[])Converts Image to Pdfpublic Byte[] Convert(Byte[] pdfToAppendTo)Function Convert(pdfToAppendTo As Byte()) As Byte()ParameterspdfToAppendToByte[]Contents of Pdf in byte array format, to which the current conversion needs to be appended toReturnsByte[]returns a Task where the result type is byte arrayLicensing InfoThis method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:An active DynamicPDF SubscriptionAn active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.A DynamicPDF Converter for .NET v3.X Developer license.ExamplesThis example shows how to use convert method with appendToPdf as parameter and output byte array as return type.Imports ceTe.DynamicPDF.ConversionModule Module1Sub Main() ' Create new instance of Converter by providing suitable parameters. Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg") ' Call Convert method to start conversion Dim output As Byte() = imageConversion.Convert() If (output IsNot Nothing) Then Dim finalOutput As Byte() = imageConversion.Convert(output) 'save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf", finalOutput) End IfEnd Sub End Moduleusing ceTe.DynamicPDF.Conversion;class MyClass{ static void Main() { // Create new instance of Converter. ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg"); //Call Convert method to start conversion byte []output=image.Convert(); if(output!=null) { byte []finalOutputByte=image.Convert(output); //save byte array output to a file. File.WriteAllBytes("C:\MyOutputFile.pdf",finalOutputByte); }
2025-04-19Uint size) { int read_size = 0; file_.Seek(offset, SeekOrigin.Begin); byte[] array = new byte[size + 1]; read_size = file_.Read(array, 0, (int)size); Marshal.Copy(array, 0, buffer, (int)size); return read_size == size ? true : false; } public override void Release() { this.file_.Close(); } }...FileReader file_reader = new FileReader(offset);file_reader.LoadFile(file_name);PDFDoc doc_real = new PDFDoc(file_reader, false)error_code = doc.Load(null);if (error_code != ErrorCode.e_ErrSuccess) return;...How to load PDF document and get the first page of the PDF documentusing foxit.pdf;using foxit.common;...PDFDoc doc = new PDFDoc("Sample.pdf");error_code = doc.Load(null);if (error_code != ErrorCode.e_ErrSuccess) return;...// Get the first page of the document.PDFPage page = doc.GetPage(0);// Parse page.page.StartParse((int)foxit.pdf.PDFPage.ParseFlags.e_ParsePageNormal, null, false);...How to save a PDF to a fileusing foxit.pdf;using foxit.common;...PDFDoc doc = new PDFDoc("Sample.pdf");error_code = doc.Load(null);if (error_code != ErrorCode.e_ErrSuccess) return;...// Do operations for the PDF document....// Save the changes for the PDF document.string newPdf = "the output path for the saved PDF";doc.SaveAs(newPdf, (int)PDFDoc.SaveFlags.e_SaveFlagNoOriginal);How to save a document into memory buffer by FileWriterCallbackusing foxit.pdf;using foxit.common;using foxit.common.fxcrt;using System.IO;using System.Runtime.InteropServices;...class FileWriter : FileWriterCallback{ private MemoryStream memoryfilestream = new MemoryStream(); public FileWriter() { } public override long GetSize() { return this.memoryfilestream.Length; } public override bool WriteBlock(IntPtr pData, long offset, uint size) { byte[] ys = new byte[size]; Marshal.Copy(pData, ys, 0, (int)size); memoryfilestream.Write(ys, 0, (int)size); return true; } public override bool Flush() { return true; } public override void Release() { }}...FileWriter fileWriter = new FileWriter();// Assuming PDFDoc doc has been loaded....doc.StartSaveAs(fileWriter, (int) PDFDoc.SaveFlags.e_SaveFlagNoOriginal,null);...PagePDF Page is the basic and important component of PDF Document. A PDFPage object is retrieved from a PDF document by function PDFDoc.GetPage. Page level APIs provide
2025-03-29