C# - How to Responsive StimulSoft Design - c#

I am new to C# and StimullSoft Report.
I have a report.mrt file that created by Stimulsoft (ver 2012) and Paper size that report has been designed is A4.
On form I have a header, Footer and several textboxes. no panel and etc.
If users change paper size from print preview, all of content on REPORT.mrt has been moved! (Big, Small, Change and So ugly!) What is the solution?
Thanks

Align the Header and footer texts by using Dock style property. Also it will be better if you use use latest versions of Stimulsoft.

Related

WPF - Convert Rich text box contents to a bitmap image

Is there any way I can convert the contents of a rich text box to a bitmap in WPF?
I tried the solution mentioned in the following post: Saving RichTextBox FlowDocument to image
But my dilemma is I am unable to figure out how to calculate the required size of the bitmap before hand that would cover the entire flow document.
Please help. Thanks in advance.
FlowDocuments don't have a rigid size, that's the point:
Flow Document Overview:
Flow documents are designed to optimize viewing and readability. Rather than being set to one predefined layout, flow documents dynamically adjust and reflow their content based on run-time variables such as window size, device resolution, and optional user preferences.
You need to set either a height or a width restraint, or both. If you set only one, width for example, the FlowDocument will update to stretch vertically until all the content has been displayed. After you set the constraint(s), you can check the actual size of the document and that will give you the required size of your image.

Continuous Labelling using iTextSharp PDF

I have working iTextsharp code for printing labels. Now the problem is, I have a requirement to print the labels in Continuous paper which i am not able to select in iTextsharp configuration (iTextSharp.text.PageSize.A4). Please advice how can i select the page size according to my current scenario.
Thanks
Your problem is related to PDF as a document format. In PDF, the content is distributed over different pages. You can define the size of such a page yourself. You mention iTextSharp.text.PageSize.A4, but you can define the page size as a Rectangle object yourself. See iTextsharp landscape document
If you want a long, narrow page, you could define the page size like this:
Document Doc = new Document(new Rectangle(595f, 14400f));
There are some implementation limits though. The maximum height or width of a page is 14,400 user units. See the blog post Help, I only see blank pages in my PDF!
However, I am pretty sure that you don't want to create a long narrow page. If you want to print labels on "continuous paper", you want to create a PDF document in which every page has the size of exactly one label. Your PDF will have as many pages as there are labels.
Suppose that the size of one label is 5 by 2 inch (width: 12.7cm; height: 5.08cm), then you should create a document like this:
Document Doc = new Document(new Rectangle(360, 144));
And you should make sure that all the content of a label fits on a single page. Your label printer should know that each page in the PDF should be printed on a separate label.
(Thank you #amedeeVanGasse for correcting my initial answer.)

Programmatically resize an image in a report

My C# application generates a Crystal Report that contains many images with varying size, orientation, and aspect ratio. To make them appear correctly in the report, I use a white Square Canvas and center the image inside. This makes lot of wasted space:
Is it possible to resize each picture in the report to the appropriate size from C#? I have found a way to resize the images here, but I don't know if I can perform these steps from c#, especially when it comes to "Calculating and setting Width and Height to the proper number of twips."
I know the size of my image in C#, but can it be passed to and implemented in the report? Images are inside an xml file in base64 format.
Designer View:
Okay, i don't have a working solution but an idea that might help you ( and i hope it will )
I searched a programmatically way to do what you want, and i don't find anything. Unless the fact that you can manipulate your FieldObject with C#, it can't be used in your report.
So, i'll try to guide you with some screenshoots, but i am French and my screens will be in french, so sorry for the bad translations !
You can write a formula to change the display of your BinaryImage in your subreport. I just found a way to change the width of you data, not the height.
So, assuming my image is stored in "ARTICLE" table, and the name of the column is "ART_IMAGE". I put my data in the detail section and create a new formula, ignore the created formula, you need to access to the "formatting formulas" :
Here in my screen it is called "Formules de mise en forme". In the left you can see my simple report and on the right the formula panel, i clicked on my details section and i can see my only field.
Now right click on this field and create a new formatting formula :
A pop up is displayed, you'll need to choose something like that in english "
Adjusting the width" :
Now, you have to return the new width of your current image, a way to know what is the current width is to store it in a field in your database.
So if in your database you have a field for your image, and a field like image_width. In my example i have a field name ART_DIMENSION and i store the width of the image.
The tricky part is that this formula accept twips not inch or cm. For you information 1 inch = 1440 twips.
So in my example here is the formula :
So for each image to display, the width of my image will be the width stored in "ART_DIMENSIONS" ( with the good convert : inch to twips )
In your report design, with a formula like this which set the width dynamically for your image, you can set the section and your image object with a very small width. In this case your images will be displayed one by another because the section width will be edited for each image to display.
I tried to be very clear, hope it will help you, ask me any questions if you don't understand something.
Regards,

ReportViewer 2010 control either prints part of a table on a separate page or prints an extra empty page

I just started using ReportViewer control VS2010 (web, local).
My report is very simple - 4 columns, all fit on a screen fine.
When I click "print" button, the report is printed on 2 pages ( 2 columns on one and 2 on another).
If I change the margins on a page, all 4 pages are printed on the same page but I still have 2nd empty page printed as well.
If report spans across multiple pages (2 for example), with margins changed I get first page, second page is empty, then third page fine and the fourth page is empty.
Any suggestion how to make the report printed without empty pages?
Thank you,
Jenny
In my experience (which has been a painful one...), I found that if the report is printing an extra page it means that somewhere, your margins or page size of the subreports (if you're using any) are not equaling 8.5 X 11 (or whatever size paper you're using). make sure that your your table (i'm assuming that's what you're using?) is in the bounds of a sheet of paper. keep in mind you need take an inch of of each side (if you're using .5" margins [.5" for each side]) to keep the table on one page.
I had the same problem and m.webster's answer was spot on for me.
Check that the SIZE property of the reports BODY is within your REPORTs Pagesize and Margin properties.
In my case, I had set my report to A4 and the properties of the report (click in the grey area of the designed) showed: PageSize: 21cm, 29.7cm. I built my report but printing resulted in content spilling over to a second page.
When I turned on the RULER option, it was immediately obvious that my reports BODY (white content area) was wider that then PageSize of the Reports page size.
When I reduced the BODY's size->width property down to 21cm (after rearranging all my content to allow this resizing) I found there I was still getting the second page problem. A quick change to the reports margins down to 0 resolved this.
The final white space problem I had was an empty page appearing at the end of some of my reports. This was resolved by reducing the height of the reports BODY so that there was no blank space after my content. Because the initial report body appears in a nice portrait layout, I had assumed that it was just representing the final page which was not the case.
Its a bit of a late answer to the problem but I've added it to save someone else the wasted hour of head scratching when using this slightly unintuitive piece of kit.

calculate html page breaks (html 2 pdf) server side for precise print layout with headers and footers

We print pdf books generated through a html to pdf application.
There is a header and footer on each page, and we place content exactly using production, and translation restrictions (and layout variations) for different languages to ensure that the fixed content for each page fits.
So for example, although our content is dynamic, a paragraph is expected to take approximatley the same amount of space for the same place in the book. We sometimes change style and layout attributes for translations but the same rules about like sizes apply.
We have a header and footer on each page, and the entire book is rendered as one long html page using css line breaking to force each header onto to a new page. So to reflect we control fixed content height per page server side.
This works well, and we are very happy with the advantages that HTML affords us in presentation (designers rather than programmers can design pages etc), we are also heavily invested in this tech, we are in too deep to change direction now, so we are not able to change our technology, we are using html 2 pdf and we need to make this work as best as possible. That is not to say we could not mix tech. but...
The problem is thus, we now have some variable sized content, that we have no former control over, to us it is text, so we have control over its formatting, but not it's quantity. We also have headings which are different sizes.
We need a way to calculate page breaks, leaving as little white space as possible, and I would love to know how anyone else is dealing with this. I know this will not be an exact science, but I still need the best approach possible.
We have total control over the rendering/layout engine it is always ie8 compatible, so different browsers need not be considered.
These are my thoughts, would love to hear yours:
This is our current method, assign a number of lines per page (variable by font-size and font to allow for different locales) each block of content will be calculated into n lines cost and this figure used to calculate pages breaks.
Pro simple
Con inaccurate, none of our fonts are monospaced, needs configuring for every locale.
Render each consecutive page of free flow content into a webpage in a div of the exact page width (fixed div) let it flow to whatever vertical height it requires, using a html 2 bmp solution capture an image and use the height of the rendered image (edge detected and cropped if required) to calculate the required number of pages.
Pro Could be accurate, not too expensive if free flow content is kept contiguous.
Con Incomplete solution, once I know the required number of pages, how do I know where to break the html? Measuring each page using this method and edge detecting would be very expensive.
On a font by font basis, knowing in advance the font sizes, padding and margins of text and headings, calculate width and line breaks and height, chracter by character using width data extracted from the font file.
Pro Once all the data had been extracted, and margins had been added for differences in HTML rendering this could likely be fairly accurate.
Con Highly intricate and sensitive to style sheet changes.
Could we use a WebBrowserControl to somehow measure the content?
Love to hear your thoughts and suggestions.
EDIT....
Our pdf converter is Winnovative, which runs within a .net Windows service, our html feed however is generated in PHP.
Kindly refer the manual
http://www.winnovative-software.com/manual%5CHTML%20to%20PDF%20Converter%20for%20.NET%20-%20Developer%27s%20Manual.htm
point 5.1.
Hope this solution helps you.
Note: the internal links are not working, so kindly manually navigate to the desired point.
This question is old, but I am doing the same basic thing as you. What I've found is that line number counting is still important, but you can use the css style line height to standardize the size of each line. (height for tr's if html is table based). This should allow you to have a constant number of lines per page.
Did you come up with a solution that worked for you?

Categories

Resources