giovedì, giugno 07, 2007

How to insert a 2D DataMatrix in a pdf using IEC16022Sharp and PdfLib

A very simple example:


using System;
using System.Collections.Generic;
using System.Text;
using PDFlib_dotnet;

using IEC16022Sharp;

namespace PdfLib7_tests
{
class Program
{
static void Main(string[] args)
{
Test_Iec16022Sharp_PdfLib();
}

private static void Test_Iec16022Sharp_PdfLib()
{
PDFlib lib = new PDFlib();
lib.begin_document("out.pdf", "");
lib.begin_page_ext(595, 842, "");

DataMatrix dm = new DataMatrix("Test using IEC16022Sharp and PdfLib");
string virtualFileName = "/pvf/image/myTestImage.bmp";
lib.create_pvf(virtualFileName, dm.FastBmp.ToByteArray(), "");
int imgID = lib.load_image("auto", virtualFileName, "");
lib.place_image(imgID, 100, 600, 1);
lib.delete_pvf(virtualFileName);

lib.end_page_ext("");
lib.end_document("");
}
}
}


IEC16022Sharp: http://sourceforge.net/projects/iec16022sharp/

PdfLib: http://www.pdflib.com

Nessun commento: