Uses TSPdfEnumerations; {$IFDEF LINUX} separator := "/"; {$ELSE} separator := "\\"; {$ENDIF} alias := ""; path := ""; InitCmdParams(alias, path); output_file := "raw_image_demo.pdf"; output_file := path + separator + output_file; pdf := new PdfFile(); pdf.SetCompressionMode(TSPdfEnumerations.COMP_ALL); // create default-font font := pdf.GetFont("Helvetica", ""); // add a new page object. page := pdf.AddPage(); page.SetWidth(172); page.SetHeight(80); height := page.GetHeight(); page.BeginText(); page.SetFontAndSize(font, 20); page.MoveTextPos(220, height - 70); page.ShowText("Raw Image Demo"); page.EndText(); raw_image_path := path + separator + "rawimage" + separator; raw_image_file1 := raw_image_path + "32_32_rgb.dat"; // load RGB raw-image file. image := pdf.LoadRawImageFromFile(alias, raw_image_file1, 32, 32, TSPdfEnumerations.CS_DEVICE_RGB); x := 20; y := 20; // Draw image to the canvas. (normal-mode with actual size.)// page.DrawImage(image, x, y, 32, 32); // load GrayScale raw-image file. raw_image_file2 := raw_image_path + "32_32_gray.dat"; image := pdf.LoadRawImageFromFile(alias, raw_image_file2, 32, 32, TSPdfEnumerations.CS_DEVICE_GRAY); x := 70; y := 20; // Draw image to the canvas. (normal-mode with actual size.)// page.DrawImage(image, x, y, 32, 32); // load GrayScale raw-image (1bit) file from memory. RAW_IMAGE_DATA := array( "0xff", "0xff", "0xff", "0xfe", "0xff", "0xff", "0xff", "0xfc", "0xff", "0xff", "0xff", "0xf8", "0xff", "0xff", "0xff", "0xf0", "0xf3", "0xf3", "0xff", "0xe0", "0xf3", "0xf3", "0xff", "0xc0", "0xf3", "0xf3", "0xff", "0x80", "0xf3", "0x33", "0xff", "0x00", "0xf3", "0x33", "0xfe", "0x00", "0xf3", "0x33", "0xfc", "0x00", "0xf8", "0x07", "0xf8", "0x00", "0xf8", "0x07", "0xf0", "0x00", "0xfc", "0xcf", "0xe0", "0x00", "0xfc", "0xcf", "0xc0", "0x00", "0xff", "0xff", "0x80", "0x00", "0xff", "0xff", "0x00", "0x00", "0xff", "0xfe", "0x00", "0x00", "0xff", "0xfc", "0x00", "0x00", "0xff", "0xf8", "0x0f", "0xe0", "0xff", "0xf0", "0x0f", "0xe0", "0xff", "0xe0", "0x0c", "0x30", "0xff", "0xc0", "0x0c", "0x30", "0xff", "0x80", "0x0f", "0xe0", "0xff", "0x00", "0x0f", "0xe0", "0xfe", "0x00", "0x0c", "0x30", "0xfc", "0x00", "0x0c", "0x30", "0xf8", "0x00", "0x0f", "0xe0", "0xf0", "0x00", "0x0f", "0xe0", "0xe0", "0x00", "0x00", "0x00", "0xc0", "0x00", "0x00", "0x00", "0x80", "0x00", "0x00", "0x00", "0x00", "0x00", "0x00", "0x00" ); RAW_IMAGE_DATA := array2str(RAW_IMAGE_DATA, ""); RAW_IMAGE_DATA := DecoderAdixstr(RAW_IMAGE_DATA, 2, 16); image := pdf.LoadRawImageFromMem(Binary(RAW_IMAGE_DATA), 32, 32, TSPdfEnumerations.CS_DEVICE_GRAY, 1); x := 120; y := 20; // Draw image to the canvas. (normal-mode with actual size.)// page.DrawImage(image, x, y, 32, 32); // save the document to a file err := pdf.SaveToFile(alias, output_file); echo "SaveToFile::\t", "err := ", format("%x", err), "\toutput_file := ", output_file, "\n"; return;