Git Product home page Git Product logo

ada-pdf-writer's People

Contributors

zertovitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jhersack

ada-pdf-writer's Issues

wide_wide_string ISO-8859-1

Hi,

it seems to me that for a very small cost, it is possible to use ISO-8859-1 characters.

 pdf.put_Line_wws ("J'adore les caractères accentués:");
      for i in 199 .. 207 loop
         pdf.put_wws ("" & Wide_Wide_Character'Val (i));
      end loop;

of the Small_demo procedure from the pdf_out_demo.adb file:

 procedure Small_demo is
      pdf : PDF_Out_File;
   begin
      pdf.Create ("Small.pdf");
      pdf.Page_Setup (A4_portrait);
      pdf.Put_Line ("This is a small demo for PDF_Out.");
      
      pdf.put_Line_wws ("J'adore les caractères accentués:");
      for i in 199 .. 207 loop
         pdf.put_wws ("" & Wide_Wide_Character'Val (i));
      end loop;
      
      pdf.New_Line;
      pdf.Put ("If you like numbers, here are some: ");
      for i in 1 .. 10 loop
         pdf.Put (i);
         pdf.Put ("... ");
      end loop;
      pdf.New_Line;
      for i in 1 .. 10 loop
         pdf.Put (Real (i) * 0.123_4, 3, 4, 0);
      end loop;
      pdf.New_Line;
      pdf.Put_Line ('[' & Img (3.141_59) & ']');
      pdf.Put_Line ('[' & Img (3.141_592_653) & ']');
      pdf.Put ("Fun, isn't it ?");
      pdf.Page_Setup (A4_landscape);
      pdf.New_Page;
      pdf.Put_Line ("Just had a page break (and switched to landscape)...");
      pdf.Close;
   end Small_demo;

I have modified the pdf_out.ads file:

with Ada.Strings.Wide_Wide_Unbounded; use Ada.Strings.Wide_Wide_Unbounded;
[...]
 procedure put_wws (pdf : in out PDF_Out_Stream; ww_str : Wide_Wide_String);
  procedure put_Line_wws
     (pdf : in out PDF_Out_Stream; ww_str : Wide_Wide_String);
   procedure put_Line_wws
     (pdf : in out PDF_Out_Stream; ww_str : Unbounded_Wide_Wide_String);

I have modified the pdf_out.adb file:

with Ada.Characters.Conversions;
[...]
  procedure put_wws(pdf:in out PDF_Out_Stream;ww_str:wide_wide_string) is
   use ada.Characters.Conversions;
   begin
      put(pdf,to_string(ww_str));
   end put_wws;

 procedure put_Line_wws
     (pdf : in out PDF_Out_Stream; ww_str : Wide_Wide_String)
   is
      use Ada.Characters.Conversions;
   begin
      Put_Line (pdf, To_String (ww_str));
   end put_Line_wws;

   procedure put_Line_wws
     (pdf : in out PDF_Out_Stream; ww_str : Unbounded_Wide_Wide_String)
   is
      use Ada.Characters.Conversions;
   begin
      Put_Line (pdf, To_String (To_Wide_Wide_String (ww_str)));
   end put_Line_wws;

put_line: parentheses not closed or closed in other put_line

Hi,

even if not all "pdf" options are implemented, apdf is very useful.

Some limitations are unexpected: recently, I searched for some time why a part of my page was not displayed: simply I had forgotten to close a parenthesis in a "STRING" expression when writing with "put_line".

Everything is back in order.

However, I can't open a parenthesis in a "put_line" entry and close it in another "put_line" entry without getting characters (I'm thinking here of the pdf translation) that are not expected.

I have summarised the situation in the code below:

-- gnatmake -P pdf_out_gnat.gpr demo.adb
-- ./demo
-- evince demo0?.pdf

with PDF_Out;   use PDF_Out;

procedure demo is
    pdf : PDF_Out_File;
begin

    --- output one two (three) four five
    pdf.Create ("demo01.pdf");
    pdf.Page_Setup (A4_portrait);
    pdf.put_line("one two (three) four five");
    pdf.close;

    --- output empty
    pdf.Create ("demo02.pdf");
    pdf.Page_Setup (A4_portrait);
    pdf.put_line("one two (three four five");
    pdf.close;

    --- output empty
    pdf.Create ("demo03.pdf");
    pdf.Page_Setup (A4_portrait);
    pdf.put_line("one two (three ");
    pdf.put_line("four");
    pdf.put_line("five");
    pdf.close;


    --- output "one two (three ) Tj T* (four) Tj T* (five)"
    pdf.Create ("demo04.pdf");
    pdf.Page_Setup (A4_portrait);
    pdf.put_line("one two (three ");
    pdf.put_line("four");
    pdf.put_line("five)");
    pdf.close;
end demo;

using ASCII.CR and ASCII.LF with put_line ?

Hi,

Is it possible to have a line feed with ascii.lf or ascii.cr in the put_line procedure, for example ?

with PDF_Out;

procedure test2 is
   use PDF_Out;
   Doc : PDF_Out_File;
begin
   Doc.Create ("my_pdf.pdf");
   Doc.Page_Setup (A4_portrait);
   Doc.put_line("Hello"&ascii.lf&"Bye.");
   Doc.Close;
end test2;

A lot of precision

I noticed at a time when switching to new compiler that the pdf file got much bigger. The reason was incredible high precision caused by the following line.

type Real is digits System.Max_Digits;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.