pdftk populated texraea is not scrollable - multiline

I am using php pdftk to take data out of a mysql database and put it in a bunch of different fields on a PDF. My issue is a few of the fields potentially have long text however instead of then showing an up/down scroll bar or even being able to scroll up or down to read all the text it seems to just get cutoff.
I am wondering if there is a specific pdftk tag or something I should use to ensure if the field has multiple rows that I can see a scroll bar to scroll up and down to ready all that would be entered in.
Here is how the pdf looks. when I load it via an iframe in the browser notice the textarea labeled HPI as multiple rows of text but no scroll bar or indication you can scroll up or down.
However if I open the template pdf file in adobe and type a bunch into that field see screenshot below you can then see a up/down scroll bar in the field labeled HPI
Here is the code
namespace Classes;
use mikehaertl\pdftk\Pdf;
class GeneratePDF {
public function generate($data, $patientid)
{
try {
$filename = "$patientid.pdf";
$pdf = new Pdf('./imports/the_template.pdf');
$pdf->fillForm($data)
->saveAs( './imports/generated_consults/' . $filename);
//->send( $filename . '.pdf');
return $filename;
}
catch(Exception $e)
{
return $e->getMessage();
}
}
}

I assume your textarea is a text field of an interactive form. The content of interactive forms can be updated using the fill_form operation of pdftk.
Interactive forms are described in the PDF Reference, version 1.7 at section 8.6 – Interactive Forms. Available options and flags for text fields are described in tables 8.69, 8.70, 8.71, and 8.77.
As I understand the reference, you have to set the Multiline flag (bit position 13) and clear the DoNotScroll flag (bit position 24). Beside that, there does not seem to be another option for that. However, I would also try if using a RichText (bit position 26) makes a difference.
If you don't modify the values of fields in a form but directly inject text objects into the PDF (I'm not sure if pdftk can even do this), then there might be no easy solution. From the PDF Reference, version 1.7, chapter 2:
A page’s appearance is described by a PDF content stream, which contains a sequence of graphics objects to be painted on the page. This appearance is fully specified; all layout and formatting decisions have already been made by the application generating the content stream.
This means there is no automatic line breaking (aka. word wrapping) in PDFs. I could also not find the ability to include scroll bars within the document. After all, a goal of PDF is to achive a consistent appearance on all devices.

Related

how to add coustomized side frame to doxygen html

I am using doxygen to generate an API document for my project written in pure C. I want to have a left side frame in the index.html generated by doxygen. So I enabled the option "GENERATE_TREEVIEW" in Doxyfile, but I am not satisfied with its layout.
I want a brief tree layout, not like this :
Files
File List
File Members
All
Functions
I have only one file to export, so I don't need "File List".
I have only functions to export(no variables, class etc.), so I don't need "File members".
And, the most reason I want to customize is that I want to classify my API into several different sub-class. Just like this:
Cursor Operation
vi_h()
vi_j()
vi_k()
vi_l()
Text Edit
vi_dw()
vi_dd()
Text Search
vi_f()
vi_F()
But doxygen seems doesn't provide a way to customize the side frame.
I have thought about another way: give up side frame, and use an category page, which can be accomplished using \section and #ref. But this is not good for readers, because every time they click, they have to switch to another web-brower tab, slow and inconvenient.

How can I render an html document with an image on it for the printdocument class so I can print it?

Private Sub document_PrintPage(ByVal sender As Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles docToPrint.PrintPage
' Insert code to render the page here.
' This code will be called when the control is drawn.
' The following code will render a simple
' message on the printed document.
'Dim text As String = "In document_PrintPage method."
'Dim printFont As New System.Drawing.Font _
' ("Arial", 35, System.Drawing.FontStyle.Regular)
'' Draw the content.
'e.Graphics.DrawString(text, printFont, _
' System.Drawing.Brushes.Black, 10, 10)
End Sub
I have code to display a printer dialog box that will call this procedure to render a document for printing. The document I want to print is accessible from a URL as an HTML webpage, and the webpage is understood to be available for printing. The sample code above, for rendering strings only, will not do what I need. I was thinking of using system.drawing.graphics.drawimage, if that can be made to work. Any ideas? I'm having trouble fully picturing the process of converting the HTML page to an image datatype. If that's not necessary, all the better.
Is there any reason you can't use System.Windows.Forms.WebBrowser?
It has a Print() method, which would seem to make your task easier. . . 8-)
Rendering HTML into an image for printing is not a trivial task. One way or the other you'll need to leverage a library that knows how to do it.
First I changed my printer dialog call so that it runs client side by using a javascript function. That was easy. The next thing was to isolate the area to be printed to the rectangle enclosing the satellite map loaded as source into an iframe. As my understanding is the javascript printer dialog would dump the whole page to the printer, I tried several things and eventually enclosed the iframe in its own div section on the asp panel that has the html button tag that calls the printer dialog and the iframe. This was enough to get only the map printed. One thing that may be necessary to allow this is that you need to use subdomains to trick the browser into thinking the iframe host and the document host are on the same domain-- I had already worked with the mapping company and our local hosting company to get that part done. The only thing left to do is to get the iframe to hold a selected zoom status of the map when I click to open the printer dialog. I will post another question for opinions on how to get an asp panel to freeze its view, or whatever other trick might enable that.

Displaying image content types as grids in drupal 7?

I am currently using the Views and Display Suite modules to create a page that works as an image gallery. You click on the menu button to take you to a page (the view) that has multiple links to nodes (individual galleries).
When you click these nodes, they take you into the separate page and show all images uploaded using the "event" content type that I made.
The event content type has one field (type: image) that uses a multiupload widget, allowing for multiple file uploads.
However, the images on the node are displayed within divs, so they all have their own rows basically. I would like to know if it was possible to put them all into grids, and if so; how? I tried using display suite, but I only have that one field to work with.
If you want to get a fully customized page and arrange the fields just like you want, use the theme suggestions.
For a node of type "event", as you said, it would be node--event.tpl.php. You can duplicate the code inside the base template node.tpl.php of your parent theme (or if you don't have one, of Bartik for example) to have a good starting material.
Just rearrange the div, the tags, the variables as your convenience, add some custom CSS to make your grid, and you should be done!
I hope it helps.

Get the div of current scroll offset of UIWebView

I have two different HTML files, two different UIWebViews & a UISegmentControl. On segmentChanged, I had displayed the WebView by loading a HTML file.
Both HTML files contains common sections only the section content is changed. Now I want to implement the functionality that, when user reads section 1.1 of first WebView & clicks Segment for loading second WebView, then the second WebView needs to scroll upto the section 1.1 which he reads in first WebView and viceversa. Also there are n number of sections.
I used following javacript but it needs the parameter of current div id. But on scroll, how can I get the current visible div id. I had given the id for each div.
function pointInView(id)
{
var divid = document.getElementById(id);
divid.scrollIntoView(true);
return false;
}
Anyone please help me.
I think jquery might be able to come to your rescue.
Could you use jQuery, since it's cross-browser compatible?
http://stackoverflow.com/questions/5353934/check-if-element-is-visible-on-screen
Check out answer form BenM
You don't really need a db entry for that. Just catch the click event via something like
$('.action').click(function(){
document.location = yourSecondFIleLocation+'?offset = ' + $('selectorDiv').detOffsetFromParentDiv(); //or get the scroll offset from the page.
});
and catch it on the second page either with php or jQuery to scroll to it.
Heck that is even achievable if you put in your code the paragraph marks and link correctly to them.
I searched a lot to get the div id from current scroll offsetbut didn't get the solution for it. So I go with the other option that, stored the start & end offsets of each section in both files. So I had created one look-up table in database & stored the start & end offsets of each section in both files.
ex. When user scrolls the first webview to section 1.1 & clicks the switch to open the second webview, then I scrolled the second webview to the section 1.1 in the second file.
Please try below,
To scroll any scroll view at any position we set the content offset of the scroll view.
To solve your problem we have two solutions,
In your case when user is viewing the first Web view, save the content offset of the first web view in any variable like below
CGFloat offset = webView1.scrollView.contentOffset.y; Then when you
open the second web view then provide this offset value to second
web view scroll offset.
Set
webView1.scrollView.contentOffset=webView2.scrollView.contentOffset
or vice versa according to your need
I hope this will help you.

GWT HTML Report Printing

I am currently working on a GWT application that requires report
printing. The use can select report parameters from a screen, and
upon clicking print we would like to display the file as it is being
generated. Currently we have server side code that is generating HTML
and writing it to a file. When the user clicks print, an RPC is being
made to pass the report parameters to the server and begin the
report. A second RPC is made after the report has started to obtain
the report's URL. From here, we are creating a Frame and setting the
URL to be the URL retrieved by the second RPC.
The issue I am running into, is that when setUrl gets
called, it only displays as much HTML that was contained in the file
at the time of the call. What would be the best way to refresh just
the frame containing the HTML report? It appears making subsequent
calls to setUrl passing in the same Url each time would do the trick,
but it actually doesn't seem to contain the additional content that
would've been written since the last call. It is also resetting the
vertical scroll bar's position each time back to the top of the bar
which is something else I would like to prevent.
Is there a better way to go about doing this?
I think it would be better to request HTML in chunks from GWT and render them as they arrive. Doing this with ajax instead of wholesale refreshes will enable better behavior with the scrollbar, eliminate flashing, get around caching problems, and will also let you add some feedback like a progress bar, estimated time remaining, etc.
There's a lot more infrastructure required for this, but your suggested solution doesn't seem quite appropriate for the task.