Re: GtkSource.PrintCompositor: How to possible printing plain text documents without lost blank lines and indentations?




 Hi Attila,

The text buffer does return the correct number of chars with spaces. If I get a char count on the lines with 
or without numbers it returns the correct number. When I export to PDF the layout is the same as the print 
preview. When I test with pdftotext then, as you say, it doesn't maintain the correct layout. Looking at 
pdftotext --help, the website is given.

The Poppler Developers - http://poppler.freedesktop.org  

They do have a mailing list to contact the developers. Have you asked them about it? Maybe it is something 
that they can fix or have a solution for. 

The other option is if the text output is consistent from pdftotext then you could parse the text and format 
it correctly before importing into a new program. 

Eric 

Test char count.
...
    #Get the lines of text to put on the page.
    cr.set_source_rgb(0.0, 0.0, 0.0)
    line_offset = page_number * self.lines_per_page
    start = self.textbuffer.get_iter_at_line(line_offset)
    end = self.textbuffer.get_iter_at_line(line_offset + self.lines_per_page - 1)
    #Test how far end of line is.
    print("Line chars " + str(end.get_chars_in_line()))
    end.forward_to_line_end()
...

 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]