|
Not exactly a cross-post but pretty close.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi,
no Mark, its not a cross post . Both are different functionalities. Can you please give me any help.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Ok, I am sorry.
I could able to convert the .doc, .xls, xlsx files in the pdf but I am looking for .png and .jpg to be converted in to pdf using .Net libraries.
Can you please provide me any sort of help? Anybody any kind of help like a code snippet or a link would be really great help.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
I'm not holding back information on you.
I did some research, and it seems that Microsoft Sharepoint, the website code that allows folks to share documents, has capabilities that allows the indexing of a folder full of office documents, to be listed like items in a store, complete with thumbnails, and so forth.
A little bit more research lead me to shell32.dll XP SP 2 and beyond, was modified to generate thumbnails of office documents.
I don't know how large your image needs to be, but shell32 should be able to provide at least 18 dpi or resolution.
Fax technology is interesting, it can convert any document as a printer to a TIFF I think at 200 dpi, or more. I haven't done any research on it yet. Just a thought.
This is as far as I have got with shell32, I'm still working in the IShellFolder interface. Most of the working examples are in c#, and I need vb so I don't have to create a new dll for it. So its managed code running c++. I pieced it together, and wrote part of it by hand.
Will take it for a test run soon, to watch it bomb, and make corrections.
Imports System
Imports System.Text
Imports System.Drawing
Imports System.Drawing.Imaging.BitmapData
Imports System.Runtime.InteropServices
Imports System.IO
Imports System.Web.UI.WebControls.Image
Public Class getThumbnails
Const MAX_PATH As Integer = 260
Public Enum IEIFLAG As Integer
ASYNC = &H1
CACHE = &H2
ASPECT = &H4
OFFLINE = &H8
GLEAM = &H10
SCREEN = &H20
ORIGSIZE = &H40
NOSTAMP = &H80
NOBORDER = &H100
QUALITY = &H200
End Enum
<StructLayout(LayoutKind.Sequential)> _
Public Structure STRRET_CSTR
Public uType As Integer
<FieldOffset(4), MarshalAs(UnmanagedType.LPWStr)> _
Public pOleStr As String
<FieldOffset(4)> _
Public uOffset As Integer
<FieldOffset(4), MarshalAs(UnmanagedType.ByValArray, SizeConst:=520)> _
Public strName As Byte()
End Structure
<StructLayout(LayoutKind.Sequential)> _
Public Structure SIZE
Public cx As Integer
Public cy As Integer
End Structure
<ComImportAttribute(), _
GuidAttribute("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IExtractImage
Sub GetLocation( _
ByVal pszPathBuffer As IntPtr, _
ByVal cch As Integer, _
ByRef pdwPriority As Integer, _
ByRef prgSize As SIZE, _
ByVal dwRecClrDepth As Integer, _
ByRef pdwFlags As Integer)
Sub Extract(ByRef phBmpThumbnail As IntPtr)
End Interface
Public Shared Function GetThumbnailImage( _
ByVal fileName As String, _
ByVal longestEdge As Integer,
ByVal colorDepth As Integer) As Image
Dim desktopFolder As IShellFolder = Nothing
Dim someFolder As IShellFolder = Nothing
Dim extract As IExtractImage = Nothing
Dim pidl As IntPtr
Dim filePidl As IntPtr
'Manually define the IIDs for IShellFolder and IExtractImage
Dim IID_IShellFolder = New Guid("000214E6-0000-0000-C000-000000000046")
Dim IID_IExtractImage = New Guid("BB2E617C-0920-11d1-9A0B-00C04FC2D6C1")
'Divide the file name into a path and file name
Dim folderName = Path.GetDirectoryName(fileName)
Dim shortFileName = Path.GetFileName(fileName)
'Get the desktop IShellFolder
IShellFolder.ShellInterop.SHGetDesktopFolder(desktopFolder)
'Get the parent folder IShellFolder
desktopFolder.ParseDisplayName(IntPtr.Zero, IntPtr.Zero, folderName, 0, pidl, 0)
desktopFolder.BindToObject(pidl, IntPtr.Zero, IID_IShellFolder, someFolder)
'Get the file's IExtractImage
someFolder.ParseDisplayName(IntPtr.Zero, IntPtr.Zero, shortFileName, 0, filePidl, 0)
someFolder.GetUIObjectOf(IntPtr.Zero, 1, filePidl, IID_IExtractImage, 0, extract)
'Set the size
Dim size As SIZE
size.cx = 500
size.cy = 500
Dim flags = IEIFLAG.ORIGSIZE Or IEIFLAG.QUALITY
Dim bmp As IntPtr
Dim thePath = Marshal.AllocHGlobal(MAX_PATH)
'Interop will throw an exception if one of these calls fail.
Try
extract.GetLocation(thePath, MAX_PATH, 0, size, colorDepth, flags)
extract.Extract(bmp)
Catch ex As Exception
End Try
'Free the global memory we allocated for the path string
Marshal.FreeHGlobal(thePath)
'Free the pidls. The Runtime Callable Wrappers
'should automatically release the COM objects
Marshal.FreeCoTaskMem(pidl)
Marshal.FreeCoTaskMem(filePidl)
If Not bmp.Equals(IntPtr.Zero) Then
GetThumbnailImage = Image.FromHbitmap(bmp)
Else
GetThumbnailImage = Nothing
End If
End Function
End Class
Imports System
Imports System.Runtime.InteropServices
<ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("000214E6-0000-0000-C000-000000000046")> _
Interface IShellFolder
<Flags()> _
Enum SHCONTF
CHECKING_FOR_CHILDREN = &H10 ' Windows 7 and later.
FOLDERS = &H20 ' Include items that are folders in the enumeration.
NONFOLDERS = &H40 ' Include items that are not folders in the enumeration.
INCLUDEHIDDEN = &H80 ' Include hidden items in the enumeration
INIT_ON_FIRST_NEXT = &H100 ' . No longer used; always assumed
NETPRINTERSRCH = &H200 ' . The calling application is looking for printer objects.
SHAREABLE = &H400 ' . The calling application is looking for resources that can be shared.
STORAGE = &H800 ' . Include items with accessible storage and their ancestors, including hidden items.
NAVIGATION_ENUM = &H1000 ' . Windows 7 and later ' . Child folders should provide a navigation enumeration.
FASTITEMS = &H2000 ' . Windows Vista and later ' . The calling application is looking for resources that can be enumerated quickly.
FLATLIST = &H4000 ' . Windows Vista and later ' . Enumerate items as a simple list even if the folder itself is not structured in that way.
ENABLE_ASYNC = &H8000 ' . Windows Vista and later ' . The calling application is monitoring for change notifications ' . This means that the enumerator does not have to return all results ' . Items can be reported through change notifications.
INCLUDESUPERHIDDEN = &H10000 ' . Windows 7 and later ' . Include hidden system items in the enumeration
End Enum
<Flags()> _
Enum E_STRRET : int
WSTR = &H0 ' Use STRRET.pOleStr
OFFSET = &H1 ' Use STRRET.uOffset to Ansi
C_STR = &H2 ' Use STRRET.cStr
End Enum
<PreserveSig()> _
Function ParseDisplayName(ByVal hwnd As IntPtr,
ByVal pbc As IntPtr, <MarshalAs(UnmanagedType.LPWStr)>
ByVal pszDisplayName As String, ByRef pchEaten As Integer,
ByRef ppidl As IntPtr,
ByRef pdwAttributes As Integer) As Integer
'
<PreserveSig()> _
Function EnumObjects(ByVal hwnd As IntPtr,
ByVal grfFlags As SHCONTF,
ByRef ppenumIDList As IntPtr) As Int32
'//////////////////////////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function BindToObject(ByVal pidl As IntPtr,
ByVal pbc As IntPtr,
ByRef riid As Guid,
ByRef ppv As IntPtr) As Int32
'
<PreserveSig()> _
Function BindToStorage(ByVal pidl As IntPtr,
ByVal pbc As IntPtr,
ByRef riid As Guid,
ByRef ppv As IntPtr) As Int32
'//////////////////////////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function CompareIDs(ByVal lParam As Int32,
ByVal pidl1 As IntPtr,
ByVal pidl2 As IntPtr) As Int32
'
<PreserveSig()> _
Function CreateViewObject(ByVal hwndOwner As IntPtr,
ByVal riid As Guid,
ByRef ppv As IntPtr) As Int32
'//////////////////////////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function GetAttributesOf(ByVal cidl As Integer,
ByRef apidl As IntPtr,
ByRef rgfInOut As Integer) As Integer
'
<PreserveSig()> _
Function GetUIObjectOf(ByVal hwndOwner As IntPtr,
ByVal cidl As UInt32,
ByVal apidl() As IntPtr,
ByVal riid As Guid,
ByRef rgfReserved As UInt32,
ByRef ppv As IntPtr) As Int32
'//////////////////////////////////////////////////////////////////////////////////////////////
<PreserveSig()> _
Function GetDisplayNameOf(ByVal pidl As IntPtr,
ByVal uFlags As Integer,
ByRef pName As E_STRRET) As Int32
'
<PreserveSig()> _
Function SetNameOf(ByVal hwnd As IntPtr,
ByVal pidl As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As [String],
ByVal uFlags As UInt32,
ByRef ppidlOut As IntPtr) As Int32
'///////////////////////////////////////////////////////////////////////////////////////////////
Sub BindToObject(pidl As IntPtr, Zero As IntPtr, IID_IShellFolder As Object, someFolder As IShellFolder)
Sub GetUIObjectOf(Zero As IntPtr, p2 As Integer, filePidl As IntPtr, IID_IExtractImage As Object, p5 As Integer, extract As getThumbnails.IExtractImage)
Class ShellInterop
<DllImport("shell32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function SHGetDesktopFolder( _
<Out()> ByRef ppshf As IShellFolder) As Integer
End Function
End Class
End Interface
|
|
|
|
|
Hi,
I am trying to understand this piece of code, its little bit hard to understand. Can you please give me a little overview of it.
I feel like its very useful for me but I want to get some idea what class and what method is doing what functionality etc.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
As far as storing a stream in a buffer, you just make a stream, and open the file, and copy the file stream into the stream. From there, you can read the stream into a byte array, and manipulate the byte array, and copy it back to a stream, and write the file.
As for the code sample that I have written,
After learning how to write in c++, I have learned that in asp.net, you can load unmanaged code written in c or c++, and use the functions inside them, as if your application was a c++ program. But in order to do so, you have to create an interface or a wrapper, that declares each internal function in vb or c#, so that vb or c# can understand them. Once vb or c# understands what's going in and what's being returned, then you can use the code successfully.
The reason the code looks so foreign, is because it's the high end of vb or c#.
The first block is a typical code, that produces your thumbnails.
The 2nd block, is the interface between vb and c++. It can be C# and c++ as well, but you need a interface to access the shell32.dll.
[EDIT]
So until I get it working, if I can, the code is of no use to anyone. That's what I meant earlier in a previous post that I have nothing to offer at the moment.
|
|
|
|
|
Hi,
Can you please show me some way to convert the png and jpg files in to svg or pdf format by without using any 3rd aprty tools (just using .net libraries or C++ .net code). Any kind of support may be by giving a code snippet or giving a link anything helps me.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
No. Can't do that
Trade secret.
|
|
|
|
|
help me to design mater page with menus and all its menus click open new page
|
|
|
|
|
No. There are a gazillion resources on the web that will show you exactly what to do and even more that have free templates that you can download. Start with Google.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi,
I have an asp.net application which has to convert different file formats like (.doc, .docx, pdf, xsl, xslx, png, jpg ..ect) in Tiff image, but if we have multiple pages word document, then all the pages are coming in one Tiff image. But we want them to come in multiple Tiff images.
Is there any way that I can divide each page as one single document and send them to the my service so that it can process each page at a time and give me the the multiple Tiff images.
Not only for the document file but I want to do it for all the formats that are mentioned above.
I am in need please help me.
Thanks,
Abdul
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
You should edit your question for clarity
Are you receiving 1 tiff from someone else, that contains all the pages?
Are you generating 1 tiff, that contains all the pages, and now you want to split them into multiple tiffs?
|
|
|
|
|
Hi,
I am gettting the various format files with multiple pages, then I am converting them in to Tiff image, which is coming as one file with multiple pages. But I want either this Tiff to be splitted in multiple files containing each page of the main Tiff as one separate file.
Or we can split multiple pages input file in to different files containing each page as one separate file.
Either way if fine for me, I should get multiple Tiff images. Advice me which approach is good for performance, and please give me code snippet or links to implement it.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
I'm in the process of creating thumbnails from doc, xls, already did pdf, and was able to create multiple image pages.
On the docs, I'm looking at the Shell32.dll built into Windows, in which it has the capability to extract images from office files, and i suppose to be able to create separate images for each page.
It's pretty complex, will let you know if it works.
Other than that, I have nothing to offer.
|
|
|
|
|
hi,
that really helps me a lot sure. thank you very much.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
You're going to have to parse each document to determine the page boundaries and create Tiffs accordingly. There's no simple way to do this: you'll need a parser for each distinct document type and a simple way to add more if users might be inclined to add further document types.
The easiest way would be to find third party controls that will do this for you rather than having to write your own for each document type. Some will even handle the Tiff creation for you (if I recall ABCPDF will do this for the pdf document types).
Another issue you will face is that of storage. Are you keeping these in the database or in a file system? How will you avoid name collisions? How will you keep track of all the separate parts of a document and so-on and so-forth...
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi,
Thanks for the message, we are handling with naming conflicts somehow by using some format for names.
I think if I can just split the Tiff image which has multiple pages would be good idea the reason for that is, in this way I would just need to split one format of the file. Because it is the output format for the all the input files.
I know I used ABCPDF once for generating pdf files, but here my management has already purchased Ecrion. Yes the files are being stored in the database.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi. Does anyone have idea of doing calculations using vb.net?
when the button is clicked and invoked, the points in the database should be deducted. I have no experience of doing calculation before.
|
|
|
|
|
|
does anyone have experience with multiple booking project using arraylist?
|
|
|
|
|
|
Hi
i am new here.im kuldeep.i have problem with gridviewi wann custom pageing in asp.netgridview and database is Sqlserver 2008
|
|
|
|
|
|
Frnds,
I have a textbox txtSalaryMonth which displays the value of Ajax CalenderExtender on click of a Image.
But when I press Another button btnOK to send the calendarVale as paramenter to Database..
It shows txtSalaryMonth.text as null...
My txtSalaryMonth.Readonly = false.
My Code is:
<ajaxToolkit:CalendarExtender ID="clnSalaryMonth" runat="server" TargetControlID="txtSalaryMonth" Format="Y" BehaviorID="calendar1"
PopupButtonID="imgSalarymonth" OnClientShown="onCalendarSalShown" OnClientHidden="onCalendarSalHidden" />
and Java Script is :
function onCalendarSalShown()
{
var cal = $find("calendar1");
cal._switchMode("months", true);
if (cal._monthsBody)
{
for (var i = 0; i < cal._monthsBody.rows.length; i++)
{
var row = cal._monthsBody.rows[i];
for (var j = 0; j < row.cells.length; j++)
{
Sys.UI.DomEvent.addHandler(row.cells[j].firstChild, "click", callSal);
}
}
}
}
function onCalendarSalHidden()
{
var cal = $find("calendar1");
if (cal._monthsBody)
{
for (var i = 0; i < cal._monthsBody.rows.length; i++)
{
var row = cal._monthsBody.rows[i];
for (var j = 0; j < row.cells.length; j++)
{
Sys.UI.DomEvent.removeHandler(row.cells[j].firstChild, "click", callSal);
}
}
}
}
function callSal(eventElement)
{
var target = eventElement.target;
switch (target.mode)
{
case "month":
var cal = $find("calendar1");
cal._visibleDate = target.date;
cal.set_selectedDate(target.date);
cal._switchMonth(target.date);
cal._blur.post(true);
cal.raiseDateSelectionChanged();
break;
}
}
plss Help
|
|
|
|
|
Hi, i have to convert string to class object in c#.
Class Admin = new Admin();
if(!((Admin)Session["Admin"]).GetRight())
{
}
i have to convert session["Admin"] to class Admin Object..
its give an error at runtime (can't convert string to class object)
Any Solution..
|
|
|
|
|