Printing RTF Text in PDFLib 9 Table Cell - perl

I am using Perl and PDFLib 9 to dynamically create a PDF document. I read some data from a DB and print a table with the data onto the PDF. One field in my DB contains RTF text. How can i print RTF text in a PDFLib table cell? I can't find any example in the PDFLib cookbook.

you can not use RTF text for PDFlib textflow/table cells. So you have to parse your RTF text and "translate" this into textflow notation. Afterwards you can format text within a multiline text by using inline options within create_textflow() or by calling multiple add_textflow() calls.

Related

in access when a Report containging tabulated data exported to word all table borders/lines disappears

I made a Report containing rows and column. When Exported it to word document ([EXternal Dat tab->export section-> more->). All the text data exported except border lines of tabulated data.
Is there any solution to keep intect the borders of table in expored word/rtf document.
I have also tried "activedocument.tables. borders.enable = true " [earlier suggested][1] but no table object found in expored rtf word file. Images- output in pdf format and output in rtf .
[1]: https://stackoverflow.com/questions/43366381/in-access-how-to-draw-tables-on-report-and-then-export-it-on-word![enter image description here](https://i.stack.imgur.com/Bruru.jpg)

Copying Nattable cells and pasting in excel does not work properly

My nattable looks like the one below.
When I copy the cells and paste in excel the cells look distorted as below.
The line break is not captured properly in the process.
The bit of code referred for copying is the same as that in the Nattable example
Is this a bug and solved in the next versions or am I missing on something.
I would not say that this is a bug in NatTable. Pasting a line break into Excel inside a cell is not that simple. You can search for this topic and see the real issue. When you copy content from NatTable, the content includes the line breaks of your cell data. The paste operation in Excel takes those line breaks and interpretes them as new row and not new line inside a cell.
You can of course implement and register a custom CopyDataCommandHandler that performs special operations to replace a line breaks in NatTable content with something that Excel handles as line breaks inside a cell.
The solution as of now is as follows :-
In Excel if the content that is sent to the Clipboard is present in double quotes and the \n is included in the double quotes Excel interprets this as a single cell content and adds the line break in the cell
Alternatively since this is a table while copying content to the clipboard we can convert it to html tags appropriately and convert it to html format which excel reads and converts appropriately.
Refer below image
However while copying between cells from Nattable to Nattable this is taken care of.

I am trying to read the time and message value field data as shown below and write it to an excel

Sample data and required excel image:
Also, Read Time section as shown in file, and populate excel file with the data in a column with the header name Time as shown above. Likewise, read the message value as shown in the .asc file and populate in excel file by converting the numbers from hexadecimal to decimal in columns named Data1, Data2, Data3,…
If your '.asc' file consists of tab delimited ASCII text then Excel will allow you to import it into an Excel worksheet.
The following explainer comes from Microsoft's Office support site:
There are two ways to import data from a text file by using Microsoft
Excel: You can open the text file in Excel, or you can import the text
file as an external data range. To export data from Excel to a text
file, use the Save As command.
There are two commonly used text file formats:
Delimited text files (.txt), in which the TAB character (ASCII
character code 009) typically separates each field of text.
Comma separated values text files (.csv), in which the comma character
(,) typically separates each field of text.
You can change the separator character that is used in both delimited
and .csv text files. This may be necessary to make sure that the
import or export operation works the way that you want it to.
If neither of those methods work for you and your '.asc' was generated by MATLAB then you may be able to use MATLAB to export directly to an Excel worksheet. MATLAB has a function xlswrite that you can use to write directly to a Microsoft Excel spreadsheet.
Another option, if you're comfortable writing some VBA code in Excel, is to use the textscan function to parse your '.asc' file.

Get text properties from PDF file

How can I get text properties using PDF::API2 or CAM::PDF? I need font size and style info.
Something like (from CAM::PDF)
$pdf->getPageContent(1);
but with text info in it.
These modules you can acheive the extract text from pdf
PDF::API2
CAM::PDF
CAM::PDF::PageText
From CPAN
my $pdf = CAM::PDF->new($filename);
my $pageone_tree = $pdf->getPageContentTree(1);
print CAM::PDF::PageText->render($pageone_tree);
This module attempts to extract sequential text from a PDF page. This is not a robust process, as PDF text is graphically laid out in arbitrary order. This module uses a few heuristics to try to guess what text goes next to what other text, but may be fooled easily by, say, subscripts, non-horizontal text, changes in font, form fields etc.
All those disclaimers aside, it is useful for a quick dump of text from a simple PDF file.
UPDATE
Read abit more in http://search.cpan.org/dist/CAM-PDF/lib/CAM/PDF.pm
But there are methods like:
$self->getFontNames(pagenum)
And others which may prove helpful.

is there a way to remove rtf from a database memo field within a formula in crystal reports version 11.5.10

I have a database memo field stored as rich text format ( rtf). I can drop it in a report and set the format of the field as rtf within crystal reports version 11.5.10 and see the text without the rtf control characters. However, I want to construct a crystal reports formula/function to process the ascii text, so is there a way to programmatically within crystal report to strip the rtf control characters from the memo field so I can work with only the ascii characters ?
I could not find such a function within CR or mention of a solution to this problem by googling.
Cheers,
You could try looking at this.
http://tech.groups.yahoo.com/group/BillQuick/message/937?
I found it and used it to change/override RTF font settings to print large text for easier reading. It could probably be modified to strip to ASCII.
Cheers,