Esempio n. 1
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Text();

            //open document
            PdfFileMend mender = new PdfFileMend();

            //create PdfFileMend object to add text
            mender.BindPdf(dataDir + "AddText.pdf");

            //create formatted text
            FormattedText text = new FormattedText("Aspose - Your File Format Experts!", System.Drawing.Color.AliceBlue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, true, 14);

            //set whether to use Word Wrap or not and using which mode
            mender.IsWordWrap = true;
            mender.WrapMode = WordWrapMode.Default;

            //add text in the PDF file
            mender.AddText(text, 1, 100, 200, 200, 400);

            //save changes
            mender.Save(dataDir + "AddText_out.pdf");

            //close PdfFileMend object
            mender.Close();
            
        }
Esempio n. 2
0
        public static void Run()
        {
            // ExStart:AddText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Text();

            // Open document
            PdfFileMend mender = new PdfFileMend();

            // Create PdfFileMend object to add text
            mender.BindPdf(dataDir + "AddText.pdf");

            // Create formatted text
            FormattedText text = new FormattedText("Aspose - Your File Format Experts!", System.Drawing.Color.AliceBlue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, true, 14);

            // Set whether to use Word Wrap or not and using which mode
            mender.IsWordWrap = true;
            mender.WrapMode   = WordWrapMode.Default;

            // Add text in the PDF file
            mender.AddText(text, 1, 100, 200, 200, 400);

            // Save changes
            mender.Save(dataDir + "AddText_out.pdf");

            // Close PdfFileMend object
            mender.Close();
            // ExEnd:AddText
        }
Esempio n. 3
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //create PdfFileMend object to add text
            PdfFileMend mender = new PdfFileMend(dataDir + "input.pdf", dataDir + "output.pdf");

            //add image in the PDF file
            mender.AddImage(dataDir + "aspose-logo.jpg", 1, 100, 600, 200, 700);

            //close PdfFileMend object
            mender.Close();
        }
Esempio n. 4
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Images();

            //create PdfFileMend object to add text
            PdfFileMend mender = new PdfFileMend(dataDir + "AddImage.pdf", dataDir + "AddImage_out.pdf");

            //add image in the PDF file
            mender.AddImage(dataDir + "aspose-logo.jpg", 1, 100, 600, 200, 700);

            //close PdfFileMend object
            mender.Close();
        }
Esempio n. 5
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //create PdfFileMend object to add text
            PdfFileMend mender = new PdfFileMend(dataDir + "input.pdf", dataDir + "output.pdf");

            //add image in the PDF file
            mender.AddImage(dataDir+ "aspose-logo.jpg", 1, 100, 600, 200, 700);

            //close PdfFileMend object
            mender.Close();
        }
Esempio n. 6
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Images();

            //create PdfFileMend object to add text
            PdfFileMend mender = new PdfFileMend(dataDir + "AddImage.pdf", dataDir + "AddImage_out.pdf");

            //add image in the PDF file
            mender.AddImage(dataDir+ "aspose-logo.jpg", 1, 100, 600, 200, 700);

            //close PdfFileMend object
            mender.Close();
        }
        public static void Run()
        {
            // ExStart:AddTextImagesUsingPdfFileMend
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Specify input and output PDF file paths
            string inputFile = dataDir + "inFile.pdf";
            string outputFile = dataDir + "AddTextImagesUsingPdfFileMend_out.pdf";

            // Specify image file path
            string imageName = dataDir + "aspose-logo.jpg";

            // Create file streams for all of the files to be used in the example           
            FileStream inImgStream = new FileStream(@imageName, FileMode.Open);
            FileStream outputStream = new FileStream(@outputFile, FileMode.Create);

            Document doc = new Document(inputFile);
            // Create instance of PdfFileMend class
            PdfFileMend mendor = new PdfFileMend(doc);

            // Add image to the input PDF file on page number 1 at specified location
            mendor.AddImage(inImgStream, 1, 50, 50, 100, 100);

            // Create new FormattedText type object to add text in the PDF file
            FormattedText ft = new FormattedText(
            "PdfFileMend testing! 0 rotation.",
            System.Drawing.Color.FromArgb(0, 200, 0),
            FontStyle.TimesRoman,
            EncodingType.Winansi,
            false,
            12);

            // Add text in the existing PDF file
            mendor.AddText(ft, 1, 50, 100, 100, 200);

            // Claose the PdfFileMend type object
            mendor.Close();
            // Close output file stream
            outputStream.Close();
            // ExEnd:AddTextImagesUsingPdfFileMend                      
        }
        public static void Run()
        {
            // ExStart:AddTextImagesUsingPdfFileMend
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Specify input and output PDF file paths
            string inputFile  = dataDir + "inFile.pdf";
            string outputFile = dataDir + "AddTextImagesUsingPdfFileMend_out_.pdf";

            // Specify image file path
            string imageName = dataDir + "aspose-logo.jpg";

            // Create file streams for all of the files to be used in the example
            FileStream inImgStream  = new FileStream(@imageName, FileMode.Open);
            FileStream outputStream = new FileStream(@outputFile, FileMode.Create);

            Document doc = new Document(inputFile);
            // Create instance of PdfFileMend class
            PdfFileMend mendor = new PdfFileMend(doc);

            // Add image to the input PDF file on page number 1 at specified location
            mendor.AddImage(inImgStream, 1, 50, 50, 100, 100);

            // Create new FormattedText type object to add text in the PDF file
            FormattedText ft = new FormattedText(
                "PdfFileMend testing! 0 rotation.",
                System.Drawing.Color.FromArgb(0, 200, 0),
                FontStyle.TimesRoman,
                EncodingType.Winansi,
                false,
                12);

            // Add text in the existing PDF file
            mendor.AddText(ft, 1, 50, 100, 100, 200);

            // Claose the PdfFileMend type object
            mendor.Close();
            // Close output file stream
            outputStream.Close();
            // ExEnd:AddTextImagesUsingPdfFileMend
        }
Esempio n. 9
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //create PdfFileMend object to add text
            PdfFileMend mender = new PdfFileMend(dataDir+ "input.pdf", dataDir+ "output.pdf");

            //create formatted text
            FormattedText text = new FormattedText("Aspose - Your File Format Experts!", System.Drawing.Color.AliceBlue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, true, 14);

            //set whether to use Word Wrap or not and using which mode
            mender.IsWordWrap = true;
            mender.WrapMode = WordWrapMode.Default;

            //add text in the PDF file
            mender.AddText(text, 1, 100, 200, 200, 400);

            //close PdfFileMend object
            mender.Close();
        }
Esempio n. 10
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //create PdfFileMend object to add text
            PdfFileMend mender = new PdfFileMend(dataDir + "input.pdf", dataDir + "output.pdf");

            //create formatted text
            FormattedText text = new FormattedText("Aspose - Your File Format Experts!", System.Drawing.Color.AliceBlue, System.Drawing.Color.Gray, Aspose.Pdf.Facades.FontStyle.Courier, EncodingType.Winansi, true, 14);

            //set whether to use Word Wrap or not and using which mode
            mender.IsWordWrap = true;
            mender.WrapMode   = WordWrapMode.Default;

            //add text in the PDF file
            mender.AddText(text, 1, 100, 200, 200, 400);

            //close PdfFileMend object
            mender.Close();
        }
Esempio n. 11
0
        public static void Run()
        {
            // ExStart:AddImage
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Images();

            // Open document
            PdfFileMend mender = new PdfFileMend();

            // Create PdfFileMend object to add text
            mender.BindPdf(dataDir + "AddImage.pdf");

            // Add image in the PDF file
            mender.AddImage(dataDir + "aspose-logo.jpg", 1, 100, 600, 200, 700);

            // Save changes
            mender.Save(dataDir + "AddImage_out.pdf");

            // Close PdfFileMend object
            mender.Close();
            // ExEnd:AddImage
        }
Esempio n. 12
0
        public static void Run()
        {
            // ExStart:AddImage
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Images();

            // Open document
            PdfFileMend mender = new PdfFileMend();

            // Create PdfFileMend object to add text
            mender.BindPdf(dataDir + "AddImage.pdf");

           // Add image in the PDF file
            mender.AddImage(dataDir+ "aspose-logo.jpg", 1, 100, 600, 200, 700);

            // Save changes
            mender.Save(dataDir + "AddImage_out.pdf");

            // Close PdfFileMend object
            mender.Close();
            // ExEnd:AddImage
        }
Esempio n. 13
0
        public static void Run()
        {
            // ExStart:AddBarcodeImageToPDFDocument
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_TechnicalArticles();

            // Instantiate linear barcode object, Set the Code text and symbology type for the barcode
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code39Standard, "1234567");

            // Creating memory stream and Saving barcode image to memory stream
            System.IO.Stream ms = new System.IO.MemoryStream();
            generator.Save(ms, BarCodeImageFormat.Bmp);

            // ExStart:CreatePdfDocument
            // Create Pdf document and Add a section to the Pdf document
            Document doc = new Document();

            doc.Pages.Add();
            // ExEnd:CreatePdfDocument

            // Open document
            PdfFileMend mender = new PdfFileMend();

            // Create PdfFileMend object to add barcode image
            mender.BindPdf(doc);

            // Add image in the PDF file
            mender.AddImage(ms, 1, 100, 600, 200, 700);

            // Save changes
            mender.Save(dataDir + "AddImage_out.pdf");

            // Close PdfFileMend object
            mender.Close();
            // ExEnd:AddBarcodeImageToPDFDocument
            Console.WriteLine(Environment.NewLine + "Add BarCode Image To PDF Document Finished.");
        }
Esempio n. 14
0
        // todo : This needs a better name
        public static byte[] DoThis(string pdfPath, string barCodeImagePath)
        {
            // todo : This needs to be a byte[] passed into the method
            var pathToSavePDf = AppDomain.CurrentDomain.BaseDirectory + "Document\\PDFBarCodeAttached.pdf";

            // todo : This needs to be a byte[] passed into the method
            var barcode = File.ReadAllBytes(barCodeImagePath);

            //todo : This needs to be in a using statement!
            var stream = new MemoryStream();

            stream.Write(barcode, 0, barcode.Length);

            // todo : This needs to be in a using statment!
            var mender = new PdfFileMend(pdfPath, pathToSavePDf);

            var fileInfo = new PdfFileInfo(pdfPath); //todo : this must be in a using method!

            // todo : These values need to be passed into the DoThis method!
            var lowerLeftX  = 100f;
            var lowerLeftY  = 100f;
            var upperRightX = 200f;
            var upperRightY = 200f;

            var filePages = fileInfo.NumberOfPages;

            // why would we add it to each page?
            // todo : Take page number as a paraemter into this method!
            for (var pageNumber = 1; pageNumber <= filePages; pageNumber++)
            {
                mender.AddImage(stream, pageNumber, lowerLeftX, lowerLeftY, upperRightX, upperRightY);
            }

            mender.Close();
            stream.Close();

            return(barcode);
        }