For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Please provide source code in MVC to display 3 Tabs and display the details in each tab.
For example I need like Emp, Dept, Mgr details. If I click on Emp Tab then Employee details should display, similarly Dept details should display after clicking
on Dept Tab and Manager details should display on click on Mgr tab. All details should display from database.
Converting pdf files to image so that i can then encrypt the images converted. In my case pdf to jpg. My code will convert each pdf page to an individual image file. So that if the pdf file contains 3 pages I end up with 3 jpg. I then take the 3 images and merge them together to create one big image.
I noticed that if I removed the 3 images from the file system the one bigger image will not display the image. It's as if I removed a reference to the 3 images. And will not display the bigger image properly. Here's the code to convert pdf to images image merge. In this case there are 5 jpg images I merge to one jpg. I don't understand why the merged image will not display the 3 images merged.
Below are the 2 functions to do the convert and merge.
You're getting that error as you don't have enough available memory to hold the image. When you create a bitmap using the constructor that only supplies the width and height;
new System.Drawing.Bitmap(width, height);
the bitmap defaults to a 32-bit colour bitmap so every pixel needs 32bits of memory. If you don't need that many colours you can specify your own colour depth which will reduce the amount of memory used per pixel so you can have bigger images.
finalImage = new System.Drawing.Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
If that is ok for your image size you can play with the options in PixelFormat to see what the best colour depth you can achieve.
If you google "c# large bitmap" you'll find other discussions about this, if the above doesn't work you might need to do something far more advanced like generate the proper byte streams that constitute a valid image in your desired format, but that will probably require pretty advanced knowledge of jpegs. There might also be a custom library out there that someone has already written to handle large bitmaps.
I'm not well versed in creation of bitmaps. Bare with me.
Even if your code works I don't think this answers my question. The problem is not creation of the bitmap.
I can create the images from the pdf pages fine. Say I have a pdf with 2 pages. I create two jpg images. I Then create a bigger jpg image to house the two images above. This also works just fine. My last step is to remove "delete" the unneeded two jpg images from above. When my code deletes the two jpg images the merged image no longer works.
What do you mean by the merged image no longer works? I tried your code and it worked ok. Step through it in the debugger and put a breakpoint on the .Save method of the final image, run that line and check the image is ok via the file explorer. Then step through the loop that deletes the files and see if there is any difference in the saved final image. I tried your code and it worked ok, I'm struggling to see why deleting files after you've saved your merged image would affect that saved image.
The merged image is where I draw (merge) the images created from the pdf pages.
So if I have a 5 page pdf I will end up with 5 jpgs. I then combine these 5 jpgs onto one big canvas basically another jpg image that houses the 5 images. The original 5 jpgs are then deleted from the file system so that I now end up with just one jpg.
Seems to all be working except when I delete the 5 jpgs the canvas will only show the first page.
I dynamically create 17 checkbox controls to one div which is set to runat="server" and than I am hiding that div, create the same 17 checkbox's to retrieve the checked value from them and create 30+ dynamically created additional checkbox's in another div.
When I check the first checkbox I created(in the third round of dynamically created checkboxes) and using a method to iterate through them/the second div to check if the first one is indeed checked to true I find out that it is not, ONLY when I get to the 18th checkbox, that I did not checked it is marked checked.
For some reason the creation of the first checkboxes in the second round after postback to the server affects the third round of checkboxes I create, why does it happens? And how to fix it?