Delphi Fortes Report angleLabel on top, across a report - delphi

I am making the invoice part of an application, and at this moment I am done with the invoice generation (adding products and stuff).
The next step is to have a report displaying the invoice data, ready to print.
That works too. I used Fortes Reports because it is free, easy to work with, and has a free PDF export filter, and a Preview component, so it has everything I need.
Now, my problem is that I must allow my users to Annull an invoice. So when an invoice was emitted, if there was a problem with it, I cannot just delete it later, I must Annull it (I'm not sure that is how you call it - maybe make it void), but basically the invoice stays the same (in printed form) EXCEPT we must write/draw diagonally on top of the entire invoice one word: ANNULLED with RED color.
That means I will make a new report for this case (annulled invoices) and use this one whenever the user wants to print an annulled invoice
So now in Fortes Report there is an RLAngleLabel component that allows me (in theory) to do just that: draw/write the word ANNULLED on the report. But my problem is that I add the label just fine in the btDetail RLBand, only I just can't see it in Preview, and I have no idea what I am doing wrong. If it's not visible in designtime preview, I assume it wont be visible in runtime neither.
Should I place it in a specific way? Should I add it at runtime somehow? I cant seem to be able to access the report's Canvas so I could draw it in some event...
Does anyone have any experience with what I am describing?
In order to reproduce my problem, just add a RLReport control on your form, add bands to it (Titleband, ColumnHeaderBand, DetailBand), and on a detailBand (DetailGridBand)place an AngleLabel, then right click on the report and choose Preview...
If I place the AngleLabel on the TitleBand or on ColumnHeaderBand, then it shows in preview, except that I need to place this Angled label ON TOP of the contents of the invoice, not on the header info.
In the past I used a BMP image as big as the invoice (in order to have it transparent so I would see the contents beneath it), but that made my exported PDF report 5MB in size, and that is a little too much (PNG was not working correctly - I think it would not display it transparent or something like that, so I was stuck to using BMP).
Is there any way of achieving what I want (described above)?

For whoever encounters this dilema, I reached the conclusion that I should still go with displaying an image containing the desired text as background and setting the bands to Transparent.
The angleLabel approach seems to be unknown, so I dropped it.
I use this time a PNG file that is about 30-40 KB in size and that does not bother me to have it added to the size of the final PDF.
A lot better than the previous BMP image I used before (that increased the size of the PDF file with about 5 MB).
The neweest version of RLReports works with PNG images. That saved me
Also if you have any RLDraw objects on your report, you must set it's brush style to bsClear, so it would allow the background to be visible.

Related

Close an image with Gimp Script-Fu

Stoopid question time. How do you close an image in GIMP with Script-Fu?
Sort of the Pythonic version of this: (ignore changes and close)
// close the image WITHOUT saving
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
There's nothing in the Python Procedure Browser for "close"
(You title & tag "script-fu", which is Scheme/Lisp, but then mention Python..., so going for Python...)
The theory is that a script shouldn't interfere with the UI, so you can't close an image at random.
If your script loads an image, the image can be shown to the user using a display=gimp.Display(image) (this is a gimp.Display object). You can also add a display to an already loaded image the same way. Since you created the display, you know it, you own it and so you can close it with gimp.delete(display). When the last display of an image is closed, the image is quitted.
If you don't create the display, you can take advantage of the fact that the display IDs are created in sequence and that this sequence sort of matches the image ids so unless many images have been loaded without a display or many images have go many displays, the display ID and the image ID are close to each other.
And given an integer ID, you can recover the display using the "secret" gimp._id2display(id), so if there is a single image loaded, you can find its Display with something like
for displayID in range(1,image.ID+50):
display=gimp._id2display(displayID)
if isinstance(display,gimp.Display):
break
if not display:
raise Exception('Display not found')
gimp.delete(display)
But this will misbehave if there is more than one image loaded, so beware.

C# Newbie - Vector Printing of Visio Document using AxVisioViewer ActiveX control

I am using VS2013Express to create a windows form based application which will display and eventually print Visio documents, rather than relying on the browser based Visio Viewer. Needless to say this is a very specific requirement, so really don't need anyone telling me to use the MS Visio Viewer!
So far, I can open the Visio document, display it using the AxVisioViewer.dll control. I can even print... to a degree.
The issue is that I can only print currently using a PrintFromScreen method which basically captures the image of the form as displayed on screen and creates a Raster BitMap of it.
I copy the BitMap image to a hidden panel on the form (to remove toolbars etc), then print the contents of the panel. Simple (ish)!
Here's a link to the page I used to create the panel and print the image.
What I want to be able to do is resize (Vector not Raster to retain scale) and centre the image as required to ensure the document prints properly.
You'll want to center the drawing in the control.
Check the following link.
https://msdn.microsoft.com/en-us/vba/visio-vba/articles/viewer-zoomtorect-method-visio-viewer
You may also check the zoom and pan methods.

Customising Product Specification in Rails

I work for a window manufacturing company and would like to add the functionality within the website for customers to be able to customise a product online with a visual representation when adding parts to the order.
So my question really is when parts are selected is it possible to build an SVG image via ajax or maybe Raphael?
The parts would be:
width
height
color
glass type
grid on outside of glass and so on
thanks in advace
I would do it with carefully crafted images. You can easily grow / shrink an image, hide/display an image, and overlay them (keep transparency) all with javascript on the client.
I would not do it with AJAX, instead I'd just load all the images and display, hide or overlay as needed (assuming the number of options are within reason).

Photoshop Action to insert text with a box around it

I have a 92 page catalogue (one image per page, multiple products per image) and no product codes on the image for each product.
Does anyone know of a photoshop action to allow entry of a stock code (<15chars text), that will create a filled, outline box with the text inside? It will be awful to have to do them by hand - there are hundreds and hundreds of products.
If all images have the same code, you could record the action which basically creates a macro of your activity for a single image. (Look for the record/playback buttons on the actions pane.)
If all the images have different codes, you might be better off writing (or commissioning) a small script to process the images, such as a PHP script with GD or C# and a graphics object; in both cases reading from a file so it applies the correct code to the image. However this method wouldn't give you an Adobe Photoshop document at the end of the day with an editable text box; it would be a flattened image (such as a TIFF) with the product code already rendered as part of the image.

How do I print a partially transparent image to a PDF Canvas using Delphi?

My program needs to output a (fairly complex) form to the printer, including several images. I’m currently doing this using Delphi (2006)’s Printer.Canvas, after selecting a PDF printer (PDF995). This works like a treat.
However, I’m now running into a problem: there’s one partially transparent image that needs to be placed on top of other elements (borders, background and such), with portions of that text still visible through parts of the image.
Doing this on a regular screen Canvas works fine with regular TBitmaps, by using the TransparentColor property. However, when I try to do this on a printer, it doesn’t always work; and when I try this on a PDF printer, it never works: the background turns black, or (the best result so far), turns white, but still overwrites anything underneath it.
I’ve tried achieving the same result by inserting a PNG image with alpha transparency (a.k.a. translucency) in a Word document, and then sending that to said PDF printer. The translucency disappears, but pixel transparency is maintained. So that, at least, should somehow be possible.
Anybody know how?
You mention you are using the TransparentColor property, so is it correct to say you don't really need alpha transparency and can get away with using binary transparency (transparency for each pixel is either off or on)?
If so, it might be possible to generate a Region from your bitmap.
You then use this region as a clipping region and draw the bitmap.
The PDF printer might be able to handle a clipping region correctly.
Here's an example of generating a region from a bitmap, it's used to make non-rectangular forms but the idea is the same:
http://www.delphi-central.com/BitmapShapedForm.aspx
Here is another example of setting a clipping region for your TCanvas:
http://www.efg2.com/Lab/OtherProjects/PrinterDemo2.htm
I don't think you can achieve partial transparency using a pdf printer. What you can do is get the VisPDF package. With it you can add a mask to the images contained in the pdf that you actually produce right in you're application. If this is not an option, you could combine all your background stuff in to one image. Drawing the alphachanneled thing on this image.
I also had this problem before, If I recall correctly, what I ended up doing was to create an off screen bitmap that I manipulated, then after I was done copied again and used the new bitmap copy on the canvas I was sending to the printer.
You may want to consider using a third-party PDF component in your application to render the canvas directly to PDF. I use this technique for specialized reporting (RTF, Radioemtric JPEGs, Tables, Text etc) in a commercial product I developed for Infrared Thermography. I am very happy with the performance and quality. The component I am using llPDFLib was just updated and I believe now supports full image transparency.
Best of luck. Printing images with an Alpha channel can be challenging at times in my experience.

Resources