error in generating pdf with vertical text
Posted: Thu Feb 27, 2020 12:56 pm
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;
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;