TCPDF ERROR: pagination issue - pagination

When I try to insert content more than 10000 words, PDF is not generating, it is not able to create 2 page so that content display properly:
$pdf->SetFont('helvetica', '', 9);
$pdf->AddPage();
$pdf->Ln(5);
$pdf->writeHTML( $f_html, true, 0, true, 0);
$pdf->lastPage();
$pdf->Output('workorder1.pdf', 'I');
http://propertyconditionreporter.com/new%20pdf/generate_PDF.php?id=109

This has been fixed, issue was coming as there was space in new pdf folder. Please make sure there should not be space in folders

Related

How to add custom content in fabric.Image()

I am trying to use the following suggested way to store canvas in the server:
Fabric.js - how to save canvas on server with custom attributes
But in my case, I am loading an image from a url like:
fabric.Image.fromURL(url, function(image) {
image.alt = product.skuId;
image.productClass = product.productClass;
canvas.add(image);
}, {
crossOrigin: "Annoymous"
});
But when I try to store the same in the db the newer attributes are not stored.
Is there a way to store custom attribute (or even "alt") in the DB?
Edit:
Created a fiddle with what I tried:
https://jsfiddle.net/anjhawar/dpyb7cf7/
When we press save the canvas is dumped in the local storage, but when we check the "objects" array we do not get the custom attributes i.e. "id" and "alt", as per the example.
Am I missing something?
Here my solution to store custom attribute (id).
fabric.Image.fromURL(link, function(img) {
img.set({
id : 'image_'+index,
width : canvas.width / 2,
height : canvas.height / 2
});
canvas.add(img).renderAll().setActiveObject(img);
});
For quick review here is a working code : http://jsfiddle.net/mullainathan/dpyb7cf7/1

XPages SSJS Code giving error "One or more of the source document's attachment are missing"

This line
publishedDoc.save(true, false, true);
causes the above stated error once in a while, on documents saved on the web where inline images where added via CKEditor. I can't pinpoint the circumstances that causes this error, so any hints or comments are greatly appreciated.
Here is a bit more code, so you get the context of that call:
function postSavePage(doc) {
if(doc.getItemValueString("status")=="To Be Published" || doc.getItemValueString("status")=="Save as Current Version" ) {
var saveAsCurrent = doc.getItemValueString("status")=="Save as Current Version";
var publishedDoc:NotesDocument = getCurrentlyPublishedDoc(doc);
if(!publishedDoc) {
publishedDoc = doc;
publishedDoc.replaceItemValue("status", "Published");
PublishedDoc.replaceItemValue("VERNUMBER", 1);
} else {
//******
//copy draft to temp doc
var tmpDoc:NotesDocument = database.createDocument();
doc.copyAllItems(tmpDoc, true);
//copy published to draft (for archiving)
publishedDoc.copyAllItems(doc, true);
if(saveAsCurrent) {
doc.replaceItemValue("status", "Archive (Saved As Current)");
} else {
doc.replaceItemValue("status", "Archive");
}
//copy temp (newly published) to published doc
tmpDoc.copyAllItems(publishedDoc, true);
//Make sure we set the version number if saved as current version
if(saveAsCurrent){
publishedDoc.replaceItemValue("VERNUMBER", doc.getItemValueInteger("VERNUMBER"));
}
publishedDoc.replaceItemValue("status", "Published");
updateRevisionData(doc);
if(!saveAsCurrent) {
setVersion(doc);
}
//save docs
doc.save(true, false, true);
publishedDoc.save(true, false, true);
}
}
}
Basically, this code manages verioning in a CMS-type application. Since many doc links are already present in existing content, I need to keep the UNID of the published document. That explains the nice little dance between the published doc, the temp doc and the doc, which is the draft: Draft content goes to the published version, published version goes to thte archives.
I have persistence set to "keep pages on disk" and persistence mode to "Entire page content". Not sure it makes a difference though...
Any clues? :D
Wrong event. If you want to amend document data when writing back to disk use QuerySave and don't do a document.save() on the current document.
So you might need to split your code.
Background: XPages uploads attachments (inline images are attachments) to a temp location and keeps track of them. When you save they are added into the note and discarded. The pointer to the temp files is only reset after the event chain (QuerySave, actual write to disk, PostSave). So by trying to save again you point to files that are gone.
Btw. Saving the current document (again) in a PostSave (or for that matter: premature save in QuerySave) is a popular Anti-pattern in Notes development

How to display an image generated dynamically by javascript in jsf page?

Using JSF and PrimeFaces I try to use java script external library (Highcharts) in order to display an image generated dynamically. Data used by the image is loaded from database. Image should be refreshed every n seconds.
In JSF I know that I can run java script function by
< h:outputScript name="js/volatilityChart.js">
but I have to somehow put parameters in order to appropriately display this function. I know there is possibility of calling execute() from RequestContext but I have no idea how to display an image generated in such a way. If knew I could probably use p:poll in order to refreshing it. I've searched the web but couldn't find proper solution.
Any advice will be appreciated.
Edited:
As followed BalusC suggestion and after some digging I managed to create something that suits me (simply speaking accessing bean fields and methods inside javascript code within xhtml). In XHTML I put:
<script>
//<![CDATA[
$(function () {
$('#container_portfolio').highcharts('StockChart', {
chart: {
alignTicks: false
},
rangeSelector: {
inputEnabled: $('#container').width() > 480,
selected: 1
},
title: {
text: ''
},
series: [{
type: 'column',
name: 'Volatility',
data: #{statisticsView.getStatistic()},
dataGrouping: {
units: [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]]
}
}]
});
});
//]]>
</script>
Above function works and gives what I expected. However, I would like to insert many similar calls. Is it somehow possible to extract them to separate files? It would dramatically increase manageability of the code. Thanks in advance.

uploadify disable/hide the X(or cancel) once starts uploading

I am uploading the files once the upload button is clicked rather than upon selecting the files from Browse. I wanted to achieve 2 things:
Hide/Remove the Cancel button when I hit the upload button upon selecting the files
I see a small portion of color on the progress bar, that may be confusing to some users so I want to just fill that bar once the upload starts but until then it should be empty
$("#versionFile").uploadify({
swf: 'scripts/uploadify.swf',
uploader: 'UploadDocs.ashx',
auto: false,
buttonText: 'Browse',
removeTimeout: 7
});
Any clues?
I have been searching for the fix for this for quite a time. And here what I found seems to be working..
In your upload control's jQuery(...init.js) file, you have to put some lines as following;
//...some code
'onUploadProgress': function (file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {
//...some code
$('.ui-dialog-titlebar-close').hide();
};
'onUploadError': function (file, errorCode, errorMsg, errorString) {
//...some code
$('.ui-dialog-titlebar-close').show();
};
'onQueueComplete': function (queueData) {
//...some code
$('.ui-dialog-titlebar-close').show();
};
That is it, you may send suggestions about it, if any.
Thanks for jQuery..
avigodse

Change document library document file entry type programmatically

I need to change document types (FileEntryType) for a large list of files in Liferay Document Library, but I have not been able to do so.
After hours of googeling, testing and familiarizing myself with Liferay Github repo, I decided to come here and ask for help.
This is what I have used:
ServiceContext serviceContext = new ServiceContext();
List<DLFileEntry> filesToBeUpdated = DLFileEntryServiceUtil.getFileEntries(
groupId, 0, fileEntryTypeId,
0, 10000, OrderByComparator);
for (DLFileEntry file : filesToBeUpdated) {
System.out.println("Changing file: "+ file.getName());
serviceContext.setAttribute("fileEntryTypeId", fileEntryTypeId);
DLAppServiceUtil.updateFileEntry(file.getFileEntryId(), file.getName(),
file.getMimeType(), null, file.getDescription(),
null, false, null, file.getSize(), serviceContext);
}
The files I used for testing are found correctly. The problem is with updating in the for loop: It throws always PortletException. How can I change the FileEntryType correctly?
You can also accomplish this with DLAppServiceUtil by setting the field in the ServiceContext that you pass in as the last parameter:
sc.setAttribute("fileEntryTypeId", liferayDocumentType);
Why do you use DLAppServiceUtil.updateFileEntry(...)? DLFileEntryServiceUtil has updateFileEntry method that accepts long fileEntryTypeId as a parameter.

Resources