/// <summary>
        ///     Tests the code128 C.
        /// </summary>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/19/2009" version="1.1.3.7">
        ///     Added documentation header
        /// </revision>
        private static void TestCode128C()
        {
            string text    = "98723493871103000000";
            Bitmap barcode = Code128.Encode(text, 1, 0.125F, 96, 12, 0);

            PixelChar.DrawChar(barcode, 'M', 0, 2);

            Bitmap   pixelchar = new Bitmap(70, 40);
            Graphics g         = Graphics.FromImage(pixelchar);

            g.Clear(Color.White);
            g.Dispose();
            pixelchar.SetResolution(96, 96);
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (j * 7 + i < 26)
                    {
                        char ch = (char)(j * 7 + i + 65);
                        PixelChar.DrawChar(pixelchar, ch, 10 * i, 10 * j);
                    }
                }
            }

            MemoryInputStream misStream = new MemoryInputStream(barcode, 100);

            barcode.Dispose();
            barcode.Dispose();
            DSxInput pdfInput = new DSxInput(misStream);

            DSxSystem.setLicenseKey(
                "[Insert your license key here]");
            DSxTask task = new DSxTask();

            PDFxDocument pdfDoc  = PDF.createDocument(task);
            PDFxContext  context = pdfDoc.getContext();
            PDFxPage     pdfPage = pdfDoc.createCustomPage(5, 2);

            PDFxImage bar = PDFxImage.createImageFromJPEG(pdfInput);
            double    dpi = 96D,
                      k   = 72D / dpi;

            pdfPage.drawImage(
                18, 18, k * bar.getWidth(), k * bar.getHeight(), bar);

            bar =
                PDFxImage.createImageFromJPEG(
                    new DSxInput(new MemoryInputStream(pixelchar, 100)));
            pixelchar.Dispose();
            pdfPage.drawImage(
                18, 72, k * bar.getWidth(), k * bar.getHeight(), bar);

            DSxPDFDocument dsDocument = new DSxPDFDocument(pdfDoc);

            dsDocument.save(new DSxOutput(@"bin\Debug\DSxInput2.pdf"));
        }
Пример #2
0
 /// <summary>
 ///     Activates AquaPDF
 /// </summary>
 /// <externalUnit/>
 /// <revision revisor="dev11" date="12/22/2008" version="1.0.0.0">
 ///     Member Created
 /// </revision>
 public static void Activate()
 {
     DSxSystem.setLicenseKey(LicenseKey);
 }