error in generating pdf with vertical text

General TRichView support forum. Please post your questions here
Post Reply
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

error in generating pdf with vertical text

Post by Ceprotec »

hi, i'm trying to generate pdf with synPDF, but i can't because there is a part of the text that contains vertical writing. follow the code!
can someone help me?

procedure TFrmEditorInstrumentoProtestoNovo.ExportaParaPdf ( Arquivo : string ) ;
var
i : Integer;
Metafile : TMetafile;
RVUnit : TRVUnits;
R : TRect;
//synopse
PdfDoc : TPDFDocumentGDI;
PdfPage : TPdfpage;
begin
SRichViewEdit1.Update; //srve is ScaleRichViewComponent
RVUnit := SRichViewEdit1.UnitsProgram; //Get the current value
SRichViewEdit1.UnitsProgram := rvuPixels; //Change DBSRichviewEdit to pixels for PDF Conversion

PdfDoc := TPdfDocumentGDI.Create;

for i := 1 to SRichViewEdit1.PageCount do
begin
Metafile := MakePageMetafile ( SRichViewEdit1 , i , Round ( SRichViewEdit1.PageProperty.PageWidth ) , Round ( SRichViewEdit1.PageProperty.PageHeight ) ) ;
try
PdfPage := PdfDoc.AddPage;
if i = 1 then
begin
PdfDoc.Info.Author := 'teste';
pdfdoc.Info.Title := '';
pdfdoc.Info.Keywords := '';
PdfDoc.CompressionMethod := cmFlateDecode;
pdfdoc.UseFontFallBack := true;
//PdfDoc.UseSetTextJustification := False;
PdfDoc.DefaultPaperSize := psA4;
PdfDoc.DefaultPageLandscape := False;
PdfDoc.VCLCanvas.Font.Charset := ANSI_CHARSET;
PdfDoc.UseUniscribe := False;
end;
// PdfDoc.VCLCanvas.StretchDraw( Rect(0, 0, Round(Screen.PixelsPerInch * Metafile.MMWidth / 3600), Round(Screen.PixelsPerInch * Metafile.MMHeight / 3600)), Metafile);
PdfDoc.VCLCanvas.StretchDraw ( Rect ( 0 , 0 , Round ( SRichViewEdit1.PageProperty.PageWidth ) , Round ( SRichViewEdit1.PageProperty.PageHeight ) ) , Metafile ) ;
finally
Metafile.Free;
end;
end;
SRichViewEdit1.UnitsProgram := RVUnit; //Change back to the previous value before converted to pixels

PdfDoc.SaveToFile ( Arquivo ) ;
PdfDoc.Free;

end;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: error in generating pdf with vertical text

Post by Sergey Tkachenko »

This means that this feature is not supported by SynPDF.

Strictly speaking, TRichView does not use a vertical text. Instead, it rotates the complete content of a table cell (using WinAPI SetWorldTransform function).

You can try other PDF generation libraries, or request support for SetWorldTransform from SynPDF author.
Post Reply