#1 Re: PDF Engine » Two Additional TPdfPageLayout » 2012-05-11 07:10:43

Sorry for my ignorance big_smile.
I tried with my pdf outputs and it worked. I don't know anything about pdf headers.

#2 Re: PDF Engine » Two Additional TPdfPageLayout » 2012-05-10 15:21:54

ab wrote:

In which revision did it appear?

I changed my local copy. I did not upload any source code change. May be you can apply change to next revision.

ab wrote:

Perhaps this would need to change the pdf format header.

As I see, these two little line of change is enough.

#3 PDF Engine » Two Additional TPdfPageLayout » 2012-05-10 13:50:51

fkaynakli
Replies: 5

TPdfPageLayout implemented is like this:

TPdfPageLayout = (plSinglePage, plOneColumn, plTwoColumnLeft, plTwoColumnRight);

But I realize that Acrobat has two additional page layout which I need:

TwoPageLeft and TwoPageRight

so I changed two lines of code like this:

TPdfPageLayout = (
    plSinglePage, plOneColumn, plTwoColumnLeft, plTwoColumnRight, plTwoPageLeft, 
    plTwoPageRight);
...
PDF_PAGE_LAYOUT_NAMES: array[TPdfPageLayout] of PDFString = (
    'SinglePage', 'OneColumn', 'TwoColumnLeft', 'TwoColumnRight', 'TwoPageLeft',
    'TwoPageRight');

I hope that it helps to someone.
Best Regards...

#4 PDF Engine » Extra Color Separations » 2011-11-19 08:32:54

fkaynakli
Replies: 1

Hi there;
I want to add some extra color separations beside RGB and CMYK like PANTONE 151C. I found that fpdf.php can do this. I inspected the PDF file generated by fpdf and there is an object like below:

...
5 0 obj
[/Separation /PANTONE#20151#20C
/DeviceCMYK <<
/Range [0 1 0 1 0 1 0 1] /C0 [0 0 0 0] 
/C1 [0.000 0.650 1.000 0.000] 
/FunctionType 2 /Domain [0 1] /N 1>>]
endobj
...

I made some modifications in synpdf.pas and I could generate the result below:

...
10 0 obj
<<
/Length 0
/Separation PANTONE#20151#20C
/DeviceCMYK <<
/Range [0 1 0 1 0 1 0 1] /C0 [0 0 0 0] 
/C1 [0.000 0.650 1.000 0.000 ]
/FunctionType 2 /Domain [0 1] /N 1>>]
>>
stream

endstream
endobj
...

As you can see I have some problems to choise correct functions to produce exactly same object. For example I can not add bracket ([) before (/Separation). Also I have some garbage fields like << and stream. If some one can help, I will be very pleased. Best Regards...

#5 Re: PDF Engine » Is unicode string width calculation wrong? » 2011-09-04 13:56:25

I mixed of them for two reasons:

  • I have to use CMYK colors and transparent PNG. Is it possible to use these with VCLCanvas?

  • I don't have to use kerning. If I can get unicode text width by PdfCanvas, it is enaugh for me.

#6 Re: PDF Engine » Is unicode string width calculation wrong? » 2011-09-03 14:29:26

You can download the test application from here (I updated the demo just now). What I do is:

  • Get the text width by TextExtent (for ex. to variable TxtWidth)

  • Calculate the text's left value by removing TxtWidth from rectangle's right side

  • Draw bounding rectangle for testing. I expect that text will fit in the bounding rectangle but the text always overflows bounding rectangle

  • Overflow amount depends on text content (not character count) and font (in demo app I used Times New Roman and Arial)

#7 PDF Engine » Is unicode string width calculation wrong? » 2011-09-03 13:17:26

fkaynakli
Replies: 4

Hi;
I am working on text alignment (left, right, center etc). You can download sample application from here.
I can not succeed on getting exact text width. Depending on font size, real text width differs from VCLCanvas.TextExtent().cx result.
If you try different font sizes (12, 14, 16, 18, 20, 22 etc.) by changing xFontSize constant, you will see strange results.
Thanks for your help. Best Regards...

#8 PDF Engine » Transparent PNG demo » 2011-07-23 07:36:23

fkaynakli
Replies: 1

Hi;
I worked on adding transparent PNG to PDF for couple of days and I found that php library fpdf can do this. So I translated the php code to Delphi. You can download first demo application from here. I just worked on 32bits PNG images. The code uses a grayscale image for defining pixel transparency. But I have two problems:

  • I can't extract Alpha channel from PNG directly. First load PNG image than I need to reload for extracting alpha. So it is not very effective.

  • If I use a grayscale BMP as a mask image, it is ok. But if I use a grayscale PNG as a mask image, the are some problematic pixels. I think grayscale PNG loading function has a problem..

If someone can help I will be very pleased...

#9 PDF Engine » Is there Unicode supperted version of MultilineTextRect? » 2011-07-14 13:29:16

fkaynakli
Replies: 1

Is there a function like MultilineTextRect which supports Unicode?

#10 Re: PDF Engine » Transparent PNG support? » 2011-06-15 07:28:00

ab wrote:

One possibility could be to create a wide bitmap including transparent bitmaps drawn over it, computed as a TBitmap using the VCL or Windows API, then draw it in the PDF with the text over it.
Another workaround could be to create a region around your bitmap content, then use it as clipping mask. It should work.

How can I achieve clipping with pdfimage? If someone can give a sample code for pdf, I will be very pleased.

#11 Re: PDF Engine » Transparent PNG support? » 2011-06-14 18:50:43

Thanks for the reply. What about CMYK stroke and fill colors?

Eureka. I added two functions to TPdfCanvas:

procedure TPdfCanvas.SetCMYKFillColor(C, M, Y, K: Byte);
begin
  if FContents<>nil then
    FContents.Writer.AddWithSpace(C/100).AddWithSpace(M/100).AddWithSpace(Y/100).AddWithSpace(K/100).Add('k'#10);
end;

procedure TPdfCanvas.SetCMYKStrokeColor(C, M, Y, K: Byte);
begin
  if FContents<>nil then
    FContents.Writer.AddWithSpace(C/100).AddWithSpace(M/100).AddWithSpace(Y/100).AddWithSpace(K/100).Add('K'#10);
end;

#12 PDF Engine » Transparent PNG support? » 2011-06-14 16:28:12

fkaynakli
Replies: 5

Hi;
First of all, this is a great component. I am new at this component but I have two problem:
1. I am using transparent PNG files but when I add these files to PDF, transparency disappear. Did I do something wrong or there is not transparent PNG support.
2. Is it possible to use CMYK colors and images instead of RGB?
Thanks for your help. Best Regards...

Board footer

Powered by FluxBB